sidekiq-unique-jobs 8.0.3 → 8.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq-unique-jobs might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2462acb2448a07c45eb8a1789239f859a09e079cff316fe61dc205d9ea8856a4
4
- data.tar.gz: 57449a594cd034c79001815883806098e04a92869c41cbe6044c90ab6f1fa3ae
3
+ metadata.gz: 35c1bacf5f3ad9218a2791aa90b38a9f76e98aa53891ebbfb764b948c00b21fe
4
+ data.tar.gz: 750b7b72457f8f58c50f3419eba36954a8a518dc77473861f8d18e5fd8542975
5
5
  SHA512:
6
- metadata.gz: b200d3544047b6080147b19b71ffd83a0ac42087ed29f1d84fb35b226b1418f50e37c94b309a946504c32d26b11b5fd173ade85e77c568931d33b948f1c656f9
7
- data.tar.gz: 9d12cbf3317acd4e5bd6d934616622e5ac3336ecba4e51b2b29fbf6782deab2b1af291af1471e16da7271fef42b33804b7a3c7f3475016de88bd75e2d0668684
6
+ metadata.gz: ea41240b24e440d3042a59570665b54e8bc9ffe186e10cdf4259a7f196c86f689c149586db0a37d02f75308b91fc1aedb0641f10e4d8565a0d70c4684371ad19
7
+ data.tar.gz: d12af8379f1262f92fefde8ca4fe4fbf80ff7ff2cbab477c12b3440e7d0513488adc2a6b7dbbd059ea033c7688b89734af52521b39086bacd01271de66ed449c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## [Unreleased](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.3...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Redis has deprecated the `rpoplpush`command [\#793](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/793)
10
+ - Deprecation Warning: Use of rpoplpush command in Redis [\#792](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/792)
11
+ - Logging::Middleware.context can include empty string as key when lock is not set in job hash [\#785](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/785)
12
+
13
+ ## [v8.0.3](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.3) (2023-05-27)
14
+
15
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.2...v8.0.3)
16
+
17
+ **Implemented enhancements:**
18
+
19
+ - chore\(ci\): improve matrix [\#775](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/775) ([mhenrixon](https://github.com/mhenrixon))
20
+ - chore\(ci\): better ci job output [\#772](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/772) ([mhenrixon](https://github.com/mhenrixon))
21
+
22
+ **Fixed bugs:**
23
+
24
+ - Add unlocked reflect to locksmith unlock! [\#783](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/783) ([ttstarck](https://github.com/ttstarck))
25
+ - fix\(locksmith\): replace deprecated rpoplpush w/lmove [\#781](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/781) ([GabrielaGuedes](https://github.com/GabrielaGuedes))
26
+ - fix\(unlock\): ensure callback and unlock [\#771](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/771) ([mhenrixon](https://github.com/mhenrixon))
27
+
28
+ **Closed issues:**
29
+
30
+ - `unlocked` reflection is never called [\#782](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/782)
31
+ - Migrate away from deprecated Redis commands [\#780](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/780)
32
+ - `while_executing` with `on_conflict: :reschedule` reschedules job when unlock fails [\#770](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/770)
33
+ - Redis server v6.0 compatibility [\#769](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/769)
34
+ - Locks not removed after worker finishes [\#758](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/758)
35
+
36
+ **Merged pull requests:**
37
+
38
+ - Add lock to item when lock\_type is pulled from Job class sidekiq options [\#786](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/786) ([ttstarck](https://github.com/ttstarck))
39
+ - Fix rubocop failure by expecting array to be empty [\#784](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/784) ([GabrielaGuedes](https://github.com/GabrielaGuedes))
40
+ - fix\(doc\): improve information on unlock\_failed [\#776](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/776) ([mhenrixon](https://github.com/mhenrixon))
41
+
3
42
  ## [v8.0.2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.2) (2023-03-13)
4
43
 
5
44
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.1...v8.0.2)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SidekiqUniqueJobs
2
2
 
3
- [![Join the chat at https://gitter.im/mhenrixon/sidekiq-unique-jobs](https://badges.gitter.im/mhenrixon/sidekiq-unique-jobs.svg)](https://gitter.im/mhenrixon/sidekiq-unique-jobs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Build Status](https://github.com/mhenrixon/sidekiq-unique-jobs/actions/workflows/rspec.yml/badge.svg?branch=master) [![Code Climate](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs) [![Test Coverage](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/badges/coverage.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/coverage)
3
+ [![Join the chat at https://gitter.im/mhenrixon/sidekiq-unique-jobs](https://badges.gitter.im/mhenrixon/sidekiq-unique-jobs.svg)](https://gitter.im/mhenrixon/sidekiq-unique-jobs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Build Status](https://github.com/mhenrixon/sidekiq-unique-jobs/actions/workflows/rspec.yml/badge.svg?branch=main) [![Code Climate](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs) [![Test Coverage](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/badges/coverage.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/coverage)
4
4
 
5
5
  ## Support Me
6
6
 
@@ -93,7 +93,7 @@ module SidekiqUniqueJobs
93
93
  [
94
94
  total_size.to_i,
95
95
  digests[0].to_i, # next_cursor
96
- digests[1].map { |digest, score| Lock.new(digest, time: score) }, # entries
96
+ digests[1].each_slice(2).map { |digest, score| Lock.new(digest, time: score) }, # entries
97
97
  ]
98
98
  end
99
99
  end
@@ -47,7 +47,7 @@ module SidekiqUniqueJobs
47
47
  #
48
48
  def initialize(key, time: nil)
49
49
  @key = get_key(key)
50
- time = time.is_a?(Float) ? time : time.to_f
50
+ time = time.to_f unless time.is_a?(Float)
51
51
  return unless time.nonzero?
52
52
 
53
53
  @created_at = time
@@ -113,14 +113,20 @@ module SidekiqUniqueJobs
113
113
 
114
114
  # the strategy to use as conflict resolution from sidekiq client
115
115
  def on_client_conflict
116
- @on_client_conflict ||= on_conflict["client"] || on_conflict[:client] if on_conflict.is_a?(Hash)
117
- @on_client_conflict ||= on_conflict
116
+ @on_client_conflict ||= if on_conflict.is_a?(Hash)
117
+ on_conflict["client"] || on_conflict[:client]
118
+ else
119
+ on_conflict
120
+ end
118
121
  end
119
122
 
120
123
  # the strategy to use as conflict resolution from sidekiq server
121
124
  def on_server_conflict
122
- @on_server_conflict ||= on_conflict["server"] || on_conflict[:server] if on_conflict.is_a?(Hash)
123
- @on_server_conflict ||= on_conflict
125
+ @on_server_conflict ||= if on_conflict.is_a?(Hash)
126
+ on_conflict["server"] || on_conflict[:server]
127
+ else
128
+ on_conflict
129
+ end
124
130
  end
125
131
  end
126
132
  end
@@ -21,7 +21,7 @@ module SidekiqUniqueJobs
21
21
  # This will mess up sidekiq stats because a new job is created
22
22
  def call
23
23
  if sidekiq_job_class?
24
- if job_class.set(queue: item["queue"].to_sym).perform_in(5, *item[ARGS])
24
+ if job_class.set(queue: item["queue"].to_sym).perform_in(schedule_in, *item[ARGS])
25
25
  reflect(:rescheduled, item)
26
26
  else
27
27
  reflect(:reschedule_failed, item)
@@ -30,6 +30,10 @@ module SidekiqUniqueJobs
30
30
  reflect(:unknown_sidekiq_worker, item)
31
31
  end
32
32
  end
33
+
34
+ def schedule_in
35
+ job_class.get_sidekiq_options["schedule_in"] || 5
36
+ end
33
37
  end
34
38
  end
35
39
  end
@@ -192,7 +192,7 @@ module SidekiqUniqueJobs
192
192
  # @return [void]
193
193
  #
194
194
  def register_reaper_process
195
- redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, nx: true, ex: drift_reaper_interval) }
195
+ redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, "nx", "ex", drift_reaper_interval) }
196
196
  end
197
197
 
198
198
  #
@@ -202,7 +202,7 @@ module SidekiqUniqueJobs
202
202
  # @return [void]
203
203
  #
204
204
  def refresh_reaper_mutex
205
- redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, ex: drift_reaper_interval) }
205
+ redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, "ex", drift_reaper_interval) }
206
206
  end
207
207
 
208
208
  #
@@ -79,7 +79,7 @@ module SidekiqUniqueJobs
79
79
  def expired_digests
80
80
  max_score = (start_time - reaper_timeout).to_f
81
81
 
82
- conn.zrange(EXPIRING_DIGESTS, 0, max_score, byscore: true)
82
+ conn.zrange(EXPIRING_DIGESTS, 0, max_score, "byscore")
83
83
  end
84
84
 
85
85
  #
@@ -24,10 +24,11 @@ module SidekiqUniqueJobs
24
24
  # @return [Hash] when given with_scores: true
25
25
  #
26
26
  def entries(with_scores: true)
27
- entrys = redis { |conn| conn.zrange(key, 0, -1, withscores: with_scores) }
28
- return entrys unless with_scores
27
+ return redis { |conn| conn.zrange(key, 0, -1) } unless with_scores
29
28
 
30
- entrys.each_with_object({}) { |pair, hash| hash[pair[0]] = pair[1] }
29
+ redis { |conn| conn.zrange(key, 0, -1, "withscores") }.each_with_object({}) do |pair, hash|
30
+ hash[pair[0]] = pair[1]
31
+ end
31
32
  end
32
33
 
33
34
  #
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "8.0.3"
6
+ VERSION = "8.0.4"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-unique-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.3
4
+ version: 8.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brpoplpush-redis_script
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubygems_version: 3.4.15
237
+ rubygems_version: 3.4.20
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Sidekiq middleware that prevents duplicates jobs