sidekiq-unique-jobs 7.0.0.beta26 → 7.0.0.beta27
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/CHANGELOG.md +8 -6
- data/README.md +7 -7
- data/lib/sidekiq_unique_jobs/constants.rb +2 -0
- data/lib/sidekiq_unique_jobs/lock/validator.rb +2 -1
- data/lib/sidekiq_unique_jobs/lock_args.rb +4 -4
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +1 -1
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +1 -1
- data/lib/sidekiq_unique_jobs/testing.rb +2 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f8ac719de8bb615ca9727bc1fcce616e7b4c074c3ea9dee035cbaa0a6883948
|
4
|
+
data.tar.gz: 98062177539795c85bf3934cfa7c79396a3b9185c927a2506da61bd5cbcd6795
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0def4f823803bb1c4cce5b93a99ad78b20fa31c563094ad833ce75bcdbafbb415ca27dd8427c6b449063f09e4318e131d97e7111b3925c552791e23d6dabdb01
|
7
|
+
data.tar.gz: 745df60df4ac33e232703ba12cebeebf8ffe80147d4efcf70879701f399d5b8e714649704356321a3cdac9f181150eae0b5403a80ae9cf4be5d68cc83932989a
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v7.0.0.beta26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta26) (2020-10-28)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...v7.0.0.beta26)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- How to disable Reaper [\#543](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/543)
|
10
|
+
- Allow disabling of reaper [\#544](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/544) ([mhenrixon](https://github.com/mhenrixon))
|
6
11
|
|
7
12
|
**Merged pull requests:**
|
8
13
|
|
@@ -188,15 +193,12 @@
|
|
188
193
|
**Fixed bugs:**
|
189
194
|
|
190
195
|
- Use thread-safe digest creation mechanism [\#484](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/484) ([mhenrixon](https://github.com/mhenrixon))
|
196
|
+
- Remove digest deletion for concurrent locks [\#482](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/482) ([mhenrixon](https://github.com/mhenrixon))
|
191
197
|
|
192
198
|
## [v7.0.0.beta13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta13) (2020-03-26)
|
193
199
|
|
194
200
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta12...v7.0.0.beta13)
|
195
201
|
|
196
|
-
**Fixed bugs:**
|
197
|
-
|
198
|
-
- Remove digest deletion for concurrent locks [\#482](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/482) ([mhenrixon](https://github.com/mhenrixon))
|
199
|
-
|
200
202
|
## [v7.0.0.beta12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta12) (2020-03-25)
|
201
203
|
|
202
204
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.20...v7.0.0.beta12)
|
data/README.md
CHANGED
@@ -536,7 +536,7 @@ The method or the proc can return a modified version of args without the transie
|
|
536
536
|
class UniqueJobWithFilterMethod
|
537
537
|
include Sidekiq::Worker
|
538
538
|
sidekiq_options lock: :until_and_while_executing,
|
539
|
-
|
539
|
+
lock_args_method: :lock_args # this is default and will be used if such a method is defined
|
540
540
|
|
541
541
|
def self.lock_args(args)
|
542
542
|
[ args[0], args[2][:type] ]
|
@@ -549,7 +549,7 @@ end
|
|
549
549
|
class UniqueJobWithFilterProc
|
550
550
|
include Sidekiq::Worker
|
551
551
|
sidekiq_options lock: :until_executed,
|
552
|
-
|
552
|
+
lock_args_method: ->(args) { [ args.first ] }
|
553
553
|
|
554
554
|
...
|
555
555
|
|
@@ -561,7 +561,7 @@ It is possible to ensure different types of unique args based on context. I can'
|
|
561
561
|
```ruby
|
562
562
|
class UniqueJobWithFilterMethod
|
563
563
|
include Sidekiq::Worker
|
564
|
-
sidekiq_options lock: :until_and_while_executing,
|
564
|
+
sidekiq_options lock: :until_and_while_executing, lock_args_method: :lock_args
|
565
565
|
|
566
566
|
def self.lock_args(args)
|
567
567
|
if Sidekiq::ProcessSet.new.size > 1
|
@@ -622,8 +622,8 @@ For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required
|
|
622
622
|
```ruby
|
623
623
|
class MyWorker
|
624
624
|
sidekiq_retries_exhausted do |msg, _ex|
|
625
|
-
digest = msg['
|
626
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
625
|
+
digest = msg['lock_digest']
|
626
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
627
627
|
end
|
628
628
|
end
|
629
629
|
```
|
@@ -633,8 +633,8 @@ Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
|
|
633
633
|
```ruby
|
634
634
|
Sidekiq.configure_server do |config|
|
635
635
|
config.death_handlers << ->(job, _ex) do
|
636
|
-
digest = job['
|
637
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
636
|
+
digest = job['lock_digest']
|
637
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
638
638
|
end
|
639
639
|
end
|
640
640
|
```
|
@@ -19,6 +19,7 @@ module SidekiqUniqueJobs
|
|
19
19
|
LIVE_VERSION ||= "uniquejobs:live"
|
20
20
|
LOCK ||= "lock"
|
21
21
|
LOCK_ARGS ||= "lock_args"
|
22
|
+
LOCK_ARGS_METHOD ||= "lock_args_method"
|
22
23
|
LOCK_DIGEST ||= "lock_digest"
|
23
24
|
LOCK_EXPIRATION ||= "lock_expiration"
|
24
25
|
LOCK_INFO ||= "lock_info"
|
@@ -43,6 +44,7 @@ module SidekiqUniqueJobs
|
|
43
44
|
UNIQUE_ACROSS_QUEUES ||= "unique_across_queues"
|
44
45
|
UNIQUE_ACROSS_WORKERS ||= "unique_across_workers"
|
45
46
|
UNIQUE_ARGS ||= "unique_args"
|
47
|
+
UNIQUE_ARGS_METHOD ||= "unique_args_method"
|
46
48
|
UNIQUE_DIGEST ||= "unique_digest"
|
47
49
|
UNIQUE_PREFIX ||= "unique_prefix"
|
48
50
|
UNIQUE_REAPER ||= "uniquejobs:reaper"
|
@@ -12,7 +12,8 @@ module SidekiqUniqueJobs
|
|
12
12
|
# @return [Hash] a hash mapping of deprecated keys and their new value
|
13
13
|
DEPRECATED_KEYS = {
|
14
14
|
UNIQUE.to_sym => LOCK.to_sym,
|
15
|
-
UNIQUE_ARGS.to_sym =>
|
15
|
+
UNIQUE_ARGS.to_sym => LOCK_ARGS_METHOD.to_sym,
|
16
|
+
LOCK_ARGS.to_sym => LOCK_ARGS_METHOD.to_sym,
|
16
17
|
UNIQUE_PREFIX.to_sym => LOCK_PREFIX.to_sym,
|
17
18
|
}.freeze
|
18
19
|
|
@@ -97,8 +97,8 @@ module SidekiqUniqueJobs
|
|
97
97
|
end
|
98
98
|
|
99
99
|
# The method to use for filtering unique arguments
|
100
|
-
def lock_args_method
|
101
|
-
@lock_args_method ||= worker_options
|
100
|
+
def lock_args_method
|
101
|
+
@lock_args_method ||= worker_options.slice(LOCK_ARGS_METHOD, UNIQUE_ARGS_METHOD).values.first
|
102
102
|
@lock_args_method ||= :lock_args if worker_method_defined?(:lock_args)
|
103
103
|
@lock_args_method ||= :unique_args if worker_method_defined?(:unique_args)
|
104
104
|
@lock_args_method ||= default_lock_args_method
|
@@ -106,8 +106,8 @@ module SidekiqUniqueJobs
|
|
106
106
|
|
107
107
|
# The global worker options defined in Sidekiq directly
|
108
108
|
def default_lock_args_method
|
109
|
-
default_worker_options[
|
110
|
-
default_worker_options[
|
109
|
+
default_worker_options[LOCK_ARGS_METHOD] ||
|
110
|
+
default_worker_options[UNIQUE_ARGS_METHOD]
|
111
111
|
end
|
112
112
|
|
113
113
|
#
|
@@ -25,7 +25,7 @@ local redisversion = tostring(ARGV[5])
|
|
25
25
|
-------- BEGIN delete_by_digest.lua --------
|
26
26
|
local counter = 0
|
27
27
|
local redis_version = toversion(redisversion)
|
28
|
-
local del_cmd
|
28
|
+
local del_cmd = "DEL"
|
29
29
|
|
30
30
|
log_debug("BEGIN delete_by_digest:", digest)
|
31
31
|
|
@@ -50,7 +50,7 @@ module SidekiqUniqueJobs
|
|
50
50
|
# @return [Sidekiq::Worker]
|
51
51
|
def worker_class_constantize(klazz = @worker_class)
|
52
52
|
return klazz.class if klazz.is_a?(Sidekiq::Worker) # sidekiq v6.x
|
53
|
-
return klazz
|
53
|
+
return klazz unless klazz.is_a?(String)
|
54
54
|
|
55
55
|
Object.const_get(klazz)
|
56
56
|
rescue NameError => ex
|
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.0.
|
4
|
+
version: 7.0.0.beta27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpoplpush-redis_script
|
@@ -215,7 +215,19 @@ metadata:
|
|
215
215
|
source_code_uri: https://github.com/mhenrixon/sidekiq-unique-jobs
|
216
216
|
changelog_uri: https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/CHANGELOG.md
|
217
217
|
post_install_message: |
|
218
|
-
|
218
|
+
IMPORTANT!
|
219
|
+
|
220
|
+
This version deprecated the following sidekiq_options
|
221
|
+
|
222
|
+
- sidekiq_options lock_args: :method_name
|
223
|
+
|
224
|
+
It is now configured with:
|
225
|
+
|
226
|
+
- sidekiq_options lock_args_method: :method_name
|
227
|
+
|
228
|
+
This is also true for `Sidekiq.default_worker_options`
|
229
|
+
|
230
|
+
We also deprecated the global configuration options:
|
219
231
|
- default_lock_ttl
|
220
232
|
- default_lock_ttl=
|
221
233
|
- default_lock_timeout
|