sidekiq-unique-jobs 7.0.12 → 7.0.13

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: 997eb6014dde8ab2896a7ccae9f1a6da4b298e1215fc7614366984b35a9b2786
4
- data.tar.gz: '09904fed282a0cd42d3a92b22ee590a202eeb41ee111958bf17b703fc8664fbd'
3
+ metadata.gz: 31de42f9427b913ae2c311fe70bd63c1ebed4dba96de6837d5e1f489644f7222
4
+ data.tar.gz: 46a500dc20edc1cbaa562a27ad66522819359deead834a97cf7bd08d1c50cc08
5
5
  SHA512:
6
- metadata.gz: '079842a1365a76ff6f17d1056848cc22774bb7007ae02e477609fff9544655f0b26e7d583963abcade5df1988b750a2efc7b16217b488d232664f8279f45c44c'
7
- data.tar.gz: b287ea28677b4f5b0c52773038e3a4152fa531136e4f46c7bb4a81c888c3e3dd055cb9c4c8f5ba1872a152ac16fefdf2908bc7f10044b44f63cfdc6bbfeffb4e
6
+ metadata.gz: b8fd43403d772a57add9fa5a6d1fef4e728b53e14a72df440e68eb345d6e3a867132de697ad483fd197ebfe3bc77bc2d80ab17af5727eac96c69ef31e29d4447
7
+ data.tar.gz: fa2ecad50220f6cf6cb2b72666094f1761cb1c2671a505d4d804374b50b08a4b78b80ba82561f4a45f3108eb6098b8d2dd2ebfef4683aac226849412cb0eb1f9
@@ -185,22 +185,26 @@ module SidekiqUniqueJobs
185
185
  end
186
186
 
187
187
  def default_lock_ttl=(obj)
188
- warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_ttl=` instead."
188
+ warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated." \
189
+ " Please use `#{class_name}#lock_ttl=` instead."
189
190
  self.lock_ttl = obj
190
191
  end
191
192
 
192
193
  def default_lock_timeout=(obj)
193
- warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_timeout=` instead."
194
+ warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated." \
195
+ " Please use `#{class_name}#lock_timeout=` instead."
194
196
  self.lock_timeout = obj
195
197
  end
196
198
 
197
199
  def default_lock_ttl
198
- warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_ttl` instead."
200
+ warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated." \
201
+ " Please use `#{class_name}#lock_ttl` instead."
199
202
  lock_ttl
200
203
  end
201
204
 
202
205
  def default_lock_timeout
203
- warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_timeout` instead."
206
+ warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated." \
207
+ " Please use `#{class_name}#lock_timeout` instead."
204
208
  lock_timeout
205
209
  end
206
210
 
@@ -6,49 +6,49 @@
6
6
  # @author Mikael Henriksson <mikael@mhenrixon.com>
7
7
  #
8
8
  module SidekiqUniqueJobs
9
- ARGS ||= "args"
10
- APARTMENT ||= "apartment"
11
- AT ||= "at"
12
- CHANGELOGS ||= "uniquejobs:changelog"
13
- CLASS ||= "class"
14
- CREATED_AT ||= "created_at"
15
- DEAD_VERSION ||= "uniquejobs:dead"
16
- DIGESTS ||= "uniquejobs:digests"
17
- ERRORS ||= "errors"
18
- JID ||= "jid"
19
- LIMIT ||= "limit"
20
- LIVE_VERSION ||= "uniquejobs:live"
21
- LOCK ||= "lock"
22
- LOCK_ARGS ||= "lock_args"
23
- LOCK_ARGS_METHOD ||= "lock_args_method"
24
- LOCK_DIGEST ||= "lock_digest"
25
- LOCK_EXPIRATION ||= "lock_expiration"
26
- LOCK_INFO ||= "lock_info"
27
- LOCK_LIMIT ||= "lock_limit"
28
- LOCK_PREFIX ||= "lock_prefix"
29
- LOCK_TIMEOUT ||= "lock_timeout"
30
- LOCK_TTL ||= "lock_ttl"
31
- LOCK_TYPE ||= "lock_type"
32
- LOG_DUPLICATE ||= "log_duplicate"
33
- ON_CLIENT_CONFLICT ||= "on_client_conflict"
34
- ON_CONFLICT ||= "on_conflict"
35
- ON_SERVER_CONFLICT ||= "on_server_conflict"
36
- PAYLOAD ||= "payload"
37
- PROCESSES ||= "processes"
38
- QUEUE ||= "queue"
39
- RETRY ||= "retry"
40
- SCHEDULE ||= "schedule"
41
- TIME ||= "time"
42
- TIMEOUT ||= "timeout"
43
- TTL ||= "ttl"
44
- TYPE ||= "type"
45
- UNIQUE ||= "unique"
46
- UNIQUE_ACROSS_QUEUES ||= "unique_across_queues"
47
- UNIQUE_ACROSS_WORKERS ||= "unique_across_workers"
48
- UNIQUE_ARGS ||= "unique_args"
49
- UNIQUE_ARGS_METHOD ||= "unique_args_method"
50
- UNIQUE_DIGEST ||= "unique_digest"
51
- UNIQUE_PREFIX ||= "unique_prefix"
52
- UNIQUE_REAPER ||= "uniquejobs:reaper"
53
- WORKER ||= "worker"
9
+ ARGS = "args"
10
+ APARTMENT = "apartment"
11
+ AT = "at"
12
+ CHANGELOGS = "uniquejobs:changelog"
13
+ CLASS = "class"
14
+ CREATED_AT = "created_at"
15
+ DEAD_VERSION = "uniquejobs:dead"
16
+ DIGESTS = "uniquejobs:digests"
17
+ ERRORS = "errors"
18
+ JID = "jid"
19
+ LIMIT = "limit"
20
+ LIVE_VERSION = "uniquejobs:live"
21
+ LOCK = "lock"
22
+ LOCK_ARGS = "lock_args"
23
+ LOCK_ARGS_METHOD = "lock_args_method"
24
+ LOCK_DIGEST = "lock_digest"
25
+ LOCK_EXPIRATION = "lock_expiration"
26
+ LOCK_INFO = "lock_info"
27
+ LOCK_LIMIT = "lock_limit"
28
+ LOCK_PREFIX = "lock_prefix"
29
+ LOCK_TIMEOUT = "lock_timeout"
30
+ LOCK_TTL = "lock_ttl"
31
+ LOCK_TYPE = "lock_type"
32
+ LOG_DUPLICATE = "log_duplicate"
33
+ ON_CLIENT_CONFLICT = "on_client_conflict"
34
+ ON_CONFLICT = "on_conflict"
35
+ ON_SERVER_CONFLICT = "on_server_conflict"
36
+ PAYLOAD = "payload"
37
+ PROCESSES = "processes"
38
+ QUEUE = "queue"
39
+ RETRY = "retry"
40
+ SCHEDULE = "schedule"
41
+ TIME = "time"
42
+ TIMEOUT = "timeout"
43
+ TTL = "ttl"
44
+ TYPE = "type"
45
+ UNIQUE = "unique"
46
+ UNIQUE_ACROSS_QUEUES = "unique_across_queues"
47
+ UNIQUE_ACROSS_WORKERS = "unique_across_workers"
48
+ UNIQUE_ARGS = "unique_args"
49
+ UNIQUE_ARGS_METHOD = "unique_args_method"
50
+ UNIQUE_DIGEST = "unique_digest"
51
+ UNIQUE_PREFIX = "unique_prefix"
52
+ UNIQUE_REAPER = "uniquejobs:reaper"
53
+ WORKER = "worker"
54
54
  end
@@ -8,7 +8,7 @@ module SidekiqUniqueJobs
8
8
  #
9
9
  # @author Mikael Henriksson <mikael@mhenrixon.com>
10
10
  class UntilExecuted < BaseLock
11
- OK ||= "OK"
11
+ OK = "OK"
12
12
 
13
13
  # Executes in the Sidekiq server process
14
14
  # @yield to the worker class perform method
@@ -11,7 +11,7 @@ module SidekiqUniqueJobs
11
11
  #
12
12
  # @author Mikael Henriksson <mikael@mhenrixon.com>
13
13
  class WhileExecuting < BaseLock
14
- RUN_SUFFIX ||= ":RUN"
14
+ RUN_SUFFIX = ":RUN"
15
15
 
16
16
  include SidekiqUniqueJobs::OptionsWithFallback
17
17
  include SidekiqUniqueJobs::Logging::Middleware
@@ -71,7 +71,7 @@ module SidekiqUniqueJobs
71
71
  ttl ||= item[LOCK_EXPIRATION] # TODO: Deprecate at some point
72
72
  ttl ||= worker_options[LOCK_EXPIRATION] # TODO: Deprecate at some point
73
73
  ttl ||= SidekiqUniqueJobs.config.lock_ttl
74
- ttl && ttl.to_i + time_until_scheduled
74
+ ttl && (ttl.to_i + time_until_scheduled)
75
75
  end
76
76
  end
77
77
  end
@@ -55,10 +55,8 @@ module SidekiqUniqueJobs
55
55
  # @return [Class]
56
56
  #
57
57
  def lock_class
58
- @lock_class ||= begin
59
- locks.fetch(lock_type.to_sym) do
60
- raise UnknownLock, "No implementation for `lock: :#{lock_type}`"
61
- end
58
+ @lock_class ||= locks.fetch(lock_type.to_sym) do
59
+ raise UnknownLock, "No implementation for `lock: :#{lock_type}`"
62
60
  end
63
61
  end
64
62
 
@@ -182,7 +182,7 @@ module SidekiqUniqueJobs
182
182
  page_size = 50
183
183
 
184
184
  loop do
185
- range_start = page * page_size - deleted_size
185
+ range_start = (page * page_size) - deleted_size
186
186
  range_end = range_start + page_size - 1
187
187
  entries = conn.lrange(queue_key, range_start, range_end)
188
188
  page += 1
@@ -5,7 +5,7 @@ module SidekiqUniqueJobs
5
5
  #
6
6
  # @author Mikael Henriksson <mikael@mhenrixon.com>
7
7
  class Server
8
- DEATH_HANDLER ||= (lambda do |job, _ex|
8
+ DEATH_HANDLER = (lambda do |job, _ex|
9
9
  return unless (digest = job["lock_digest"])
10
10
 
11
11
  SidekiqUniqueJobs::Digests.new.delete_by_digest(digest)
@@ -68,24 +68,46 @@ module Sidekiq
68
68
  prepend UniqueExtension
69
69
  end
70
70
 
71
- # See Sidekiq::Api
72
- class Job
73
- #
74
- # Provides extensions for unlocking jobs that are removed and deleted
75
- #
76
- # @author Mikael Henriksson <mikael@mhenrixon.com>
77
- #
78
- module UniqueExtension
71
+ if Sidekiq.const_defined?("JobRecord")
72
+ # See Sidekiq::Api
73
+ class JobRecord
79
74
  #
80
- # Wraps the original method to ensure locks for the job are deleted
75
+ # Provides extensions for unlocking jobs that are removed and deleted
81
76
  #
82
- def delete
83
- SidekiqUniqueJobs::Unlockable.delete!(item)
84
- super
77
+ # @author Mikael Henriksson <mikael@mhenrixon.com>
78
+ #
79
+ module UniqueExtension
80
+ #
81
+ # Wraps the original method to ensure locks for the job are deleted
82
+ #
83
+ def delete
84
+ SidekiqUniqueJobs::Unlockable.delete!(item)
85
+ super
86
+ end
85
87
  end
88
+
89
+ prepend UniqueExtension
86
90
  end
91
+ else
92
+ # See Sidekiq::Api
93
+ class Job
94
+ #
95
+ # Provides extensions for unlocking jobs that are removed and deleted
96
+ #
97
+ # @author Mikael Henriksson <mikael@mhenrixon.com>
98
+ #
99
+ module UniqueExtension
100
+ #
101
+ # Wraps the original method to ensure locks for the job are deleted
102
+ #
103
+ def delete
104
+ SidekiqUniqueJobs::Unlockable.delete!(item)
105
+ super
106
+ end
107
+ end
87
108
 
88
- prepend UniqueExtension
109
+ prepend UniqueExtension
110
+ end
89
111
  end
90
112
 
91
113
  # See Sidekiq::Api
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.0.12"
6
+ VERSION = "7.0.13"
7
7
  end
@@ -1,21 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Style/MutableConstant
4
+ CHANGELOG_CMD = %w[
5
+ github_changelog_generator
6
+ --no-verbose
7
+ --user
8
+ mhenrixon
9
+ --project
10
+ sidekiq-unique-jobs
11
+ --token
12
+ ]
13
+ ADD_CHANGELOG_CMD = "git add --all"
14
+ COMMIT_CHANGELOG_CMD = "git commit -a -m 'Update changelog'"
15
+ # rubocop:enable Style/MutableConstant
16
+
3
17
  desc "Generate a Changelog"
4
18
  task :changelog do
5
- # rubocop:disable Style/MutableConstant
6
- CHANGELOG_CMD ||= %w[
7
- github_changelog_generator
8
- --no-verbose
9
- --user
10
- mhenrixon
11
- --project
12
- sidekiq-unique-jobs
13
- --token
14
- ]
15
- ADD_CHANGELOG_CMD ||= "git add --all"
16
- COMMIT_CHANGELOG_CMD ||= "git commit -a -m 'Update changelog'"
17
- # rubocop:enable Style/MutableConstant
18
-
19
19
  sh("git checkout master")
20
20
  sh(*CHANGELOG_CMD.push(ENV["CHANGELOG_GITHUB_TOKEN"]))
21
21
  sh(ADD_CHANGELOG_CMD)
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: 7.0.12
4
+ version: 7.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-04 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brpoplpush-redis_script
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '5.0'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '7.0'
62
+ version: '8.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '5.0'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '7.0'
72
+ version: '8.0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: thor
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -79,7 +79,7 @@ dependencies:
79
79
  version: '0.20'
80
80
  - - "<"
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '3.0'
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '0.20'
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: '2.0'
92
+ version: '3.0'
93
93
  description: |
94
94
  Prevents simultaneous Sidekiq jobs with the same unique arguments to run.
95
95
  Highly configurable to suite your specific needs.
@@ -250,14 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
250
  requirements:
251
251
  - - ">="
252
252
  - !ruby/object:Gem::Version
253
- version: 2.5.0
253
+ version: '2.5'
254
254
  required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  requirements:
256
256
  - - ">="
257
257
  - !ruby/object:Gem::Version
258
258
  version: '0'
259
259
  requirements: []
260
- rubygems_version: 3.2.19
260
+ rubygems_version: 3.2.28
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Sidekiq middleware that prevents duplicates jobs