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 +4 -4
- data/lib/sidekiq_unique_jobs/config.rb +8 -4
- data/lib/sidekiq_unique_jobs/constants.rb +45 -45
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +1 -1
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +2 -4
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +1 -1
- data/lib/sidekiq_unique_jobs/server.rb +1 -1
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +35 -13
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/tasks/changelog.rake +14 -14
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31de42f9427b913ae2c311fe70bd63c1ebed4dba96de6837d5e1f489644f7222
|
4
|
+
data.tar.gz: 46a500dc20edc1cbaa562a27ad66522819359deead834a97cf7bd08d1c50cc08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
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.
|
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
|
10
|
-
APARTMENT
|
11
|
-
AT
|
12
|
-
CHANGELOGS
|
13
|
-
CLASS
|
14
|
-
CREATED_AT
|
15
|
-
DEAD_VERSION
|
16
|
-
DIGESTS
|
17
|
-
ERRORS
|
18
|
-
JID
|
19
|
-
LIMIT
|
20
|
-
LIVE_VERSION
|
21
|
-
LOCK
|
22
|
-
LOCK_ARGS
|
23
|
-
LOCK_ARGS_METHOD
|
24
|
-
LOCK_DIGEST
|
25
|
-
LOCK_EXPIRATION
|
26
|
-
LOCK_INFO
|
27
|
-
LOCK_LIMIT
|
28
|
-
LOCK_PREFIX
|
29
|
-
LOCK_TIMEOUT
|
30
|
-
LOCK_TTL
|
31
|
-
LOCK_TYPE
|
32
|
-
LOG_DUPLICATE
|
33
|
-
ON_CLIENT_CONFLICT
|
34
|
-
ON_CONFLICT
|
35
|
-
ON_SERVER_CONFLICT
|
36
|
-
PAYLOAD
|
37
|
-
PROCESSES
|
38
|
-
QUEUE
|
39
|
-
RETRY
|
40
|
-
SCHEDULE
|
41
|
-
TIME
|
42
|
-
TIMEOUT
|
43
|
-
TTL
|
44
|
-
TYPE
|
45
|
-
UNIQUE
|
46
|
-
UNIQUE_ACROSS_QUEUES
|
47
|
-
UNIQUE_ACROSS_WORKERS
|
48
|
-
UNIQUE_ARGS
|
49
|
-
UNIQUE_ARGS_METHOD
|
50
|
-
UNIQUE_DIGEST
|
51
|
-
UNIQUE_PREFIX
|
52
|
-
UNIQUE_REAPER
|
53
|
-
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
|
@@ -11,7 +11,7 @@ module SidekiqUniqueJobs
|
|
11
11
|
#
|
12
12
|
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
13
13
|
class WhileExecuting < BaseLock
|
14
|
-
RUN_SUFFIX
|
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 ||=
|
59
|
-
|
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
|
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
|
-
|
72
|
-
|
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
|
-
#
|
75
|
+
# Provides extensions for unlocking jobs that are removed and deleted
|
81
76
|
#
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
109
|
+
prepend UniqueExtension
|
110
|
+
end
|
89
111
|
end
|
90
112
|
|
91
113
|
# See Sidekiq::Api
|
data/lib/tasks/changelog.rake
CHANGED
@@ -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.
|
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-
|
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: '
|
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: '
|
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: '
|
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: '
|
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
|
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.
|
260
|
+
rubygems_version: 3.2.28
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: Sidekiq middleware that prevents duplicates jobs
|