sidekiq-unique-jobs 7.0.0.beta22 → 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 +88 -15
- data/README.md +55 -30
- data/lib/sidekiq_unique_jobs.rb +0 -1
- data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
- data/lib/sidekiq_unique_jobs/changelog.rb +1 -1
- data/lib/sidekiq_unique_jobs/cli.rb +4 -2
- data/lib/sidekiq_unique_jobs/connection.rb +1 -1
- data/lib/sidekiq_unique_jobs/constants.rb +4 -1
- data/lib/sidekiq_unique_jobs/digests.rb +1 -1
- data/lib/sidekiq_unique_jobs/exceptions.rb +9 -9
- data/lib/sidekiq_unique_jobs/job.rb +5 -5
- data/lib/sidekiq_unique_jobs/json.rb +1 -1
- data/lib/sidekiq_unique_jobs/key.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/base_lock.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/client_validator.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/server_validator.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_expired.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/validator.rb +3 -2
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_args.rb +4 -4
- data/lib/sidekiq_unique_jobs/lock_config.rb +5 -5
- data/lib/sidekiq_unique_jobs/lock_digest.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock_info.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +1 -1
- data/lib/sidekiq_unique_jobs/locksmith.rb +1 -1
- data/lib/sidekiq_unique_jobs/logging.rb +3 -3
- data/lib/sidekiq_unique_jobs/logging/middleware_context.rb +2 -2
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_queue.lua +3 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +16 -4
- data/lib/sidekiq_unique_jobs/middleware/client.rb +5 -5
- data/lib/sidekiq_unique_jobs/middleware/server.rb +3 -3
- data/lib/sidekiq_unique_jobs/normalizer.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/log.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +1 -1
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +35 -4
- data/lib/sidekiq_unique_jobs/orphans/null_reaper.rb +24 -0
- data/lib/sidekiq_unique_jobs/orphans/observer.rb +2 -2
- data/lib/sidekiq_unique_jobs/orphans/reaper.rb +5 -1
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +5 -5
- data/lib/sidekiq_unique_jobs/profiler.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/entity.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/hash.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/list.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/set.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/string.rb +1 -1
- data/lib/sidekiq_unique_jobs/rspec/matchers.rb +2 -2
- data/lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb +2 -2
- data/lib/sidekiq_unique_jobs/script.rb +1 -1
- data/lib/sidekiq_unique_jobs/script/caller.rb +2 -2
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +5 -5
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +1 -1
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +9 -3
- data/lib/sidekiq_unique_jobs/testing.rb +2 -1
- data/lib/sidekiq_unique_jobs/timing.rb +1 -1
- data/lib/sidekiq_unique_jobs/unlockable.rb +1 -1
- data/lib/sidekiq_unique_jobs/update_version.rb +1 -1
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +1 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/version_check.rb +23 -4
- data/lib/sidekiq_unique_jobs/web.rb +1 -1
- data/lib/sidekiq_unique_jobs/web/helpers.rb +1 -1
- metadata +19 -6
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,12 +1,85 @@
|
|
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/v7.0.0.
|
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))
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Update sidekiq-unique-jobs.gemspec [\#542](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/542) ([sergey-alekseev](https://github.com/sergey-alekseev))
|
15
|
+
|
16
|
+
## [v6.0.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.25) (2020-10-26)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta25...v6.0.25)
|
19
|
+
|
20
|
+
**Implemented enhancements:**
|
21
|
+
|
22
|
+
- Support apartment [\#541](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/541) ([mhenrixon](https://github.com/mhenrixon))
|
23
|
+
- Support both instance method and class method [\#528](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/528) ([mhenrixon](https://github.com/mhenrixon))
|
24
|
+
|
25
|
+
## [v7.0.0.beta25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta25) (2020-10-26)
|
26
|
+
|
27
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
|
28
|
+
|
29
|
+
**Implemented enhancements:**
|
30
|
+
|
31
|
+
- Bump rubocop [\#539](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/539) ([mhenrixon](https://github.com/mhenrixon))
|
32
|
+
|
33
|
+
**Fixed bugs:**
|
34
|
+
|
35
|
+
- Ruby reaper not working, active jobs queried incorrectly [\#537](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/537)
|
36
|
+
- Fix RubyReaper active? [\#538](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/538) ([tanner-rutgers](https://github.com/tanner-rutgers))
|
37
|
+
|
38
|
+
**Closed issues:**
|
39
|
+
|
40
|
+
- ConnectionPool::TimeoutError and :until\_executed [\#535](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/535)
|
41
|
+
|
42
|
+
**Merged pull requests:**
|
43
|
+
|
44
|
+
- Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
|
45
|
+
|
46
|
+
## [v7.0.0.beta24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta24) (2020-09-27)
|
47
|
+
|
48
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta23...v7.0.0.beta24)
|
49
|
+
|
50
|
+
**Implemented enhancements:**
|
51
|
+
|
52
|
+
- Support both instance method and class method [\#527](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/527) ([mhenrixon](https://github.com/mhenrixon))
|
53
|
+
|
54
|
+
**Closed issues:**
|
55
|
+
|
56
|
+
- Leaked keys in version 5.0.10 [\#519](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/519)
|
57
|
+
|
58
|
+
## [v7.0.0.beta23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta23) (2020-06-23)
|
59
|
+
|
60
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.23...v7.0.0.beta23)
|
61
|
+
|
62
|
+
**Fixed bugs:**
|
63
|
+
|
64
|
+
- Exit early when no results are returned from LRANGE given jobs might already processed [\#521](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/521) ([vipulnsward](https://github.com/vipulnsward))
|
65
|
+
|
66
|
+
## [v6.0.23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.23) (2020-06-23)
|
67
|
+
|
68
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta22...v6.0.23)
|
69
|
+
|
70
|
+
**Fixed bugs:**
|
71
|
+
|
72
|
+
- Ruby reaper incorrectly checks active jobs — removes every active lock as result [\#517](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/517)
|
73
|
+
- Backport \#465 to 6.x series [\#520](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/520) ([replaid](https://github.com/replaid))
|
74
|
+
|
75
|
+
## [v7.0.0.beta22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta22) (2020-06-12)
|
76
|
+
|
77
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta21...v7.0.0.beta22)
|
6
78
|
|
7
79
|
**Fixed bugs:**
|
8
80
|
|
9
81
|
- Infinite loop in ruby reaper [\#515](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/515)
|
82
|
+
- Prevent reaping of active jobs [\#518](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/518) ([mhenrixon](https://github.com/mhenrixon))
|
10
83
|
|
11
84
|
## [v7.0.0.beta21](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta21) (2020-06-12)
|
12
85
|
|
@@ -20,7 +93,6 @@
|
|
20
93
|
**Fixed bugs:**
|
21
94
|
|
22
95
|
- Prevent indefinitely looping entries [\#516](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/516) ([mhenrixon](https://github.com/mhenrixon))
|
23
|
-
- Expire reaper when not checking in [\#508](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/508) ([mhenrixon](https://github.com/mhenrixon))
|
24
96
|
|
25
97
|
**Closed issues:**
|
26
98
|
|
@@ -42,10 +114,18 @@
|
|
42
114
|
|
43
115
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta18...v7.0.0.beta19)
|
44
116
|
|
117
|
+
**Fixed bugs:**
|
118
|
+
|
119
|
+
- Expire reaper when not checking in [\#508](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/508) ([mhenrixon](https://github.com/mhenrixon))
|
120
|
+
|
45
121
|
## [v7.0.0.beta18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta18) (2020-05-21)
|
46
122
|
|
47
123
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta17...v7.0.0.beta18)
|
48
124
|
|
125
|
+
**Fixed bugs:**
|
126
|
+
|
127
|
+
- Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
|
128
|
+
|
49
129
|
## [v7.0.0.beta17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta17) (2020-05-20)
|
50
130
|
|
51
131
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta16...v7.0.0.beta17)
|
@@ -94,7 +174,6 @@
|
|
94
174
|
- Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
|
95
175
|
- Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
|
96
176
|
- Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
|
97
|
-
- Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
|
98
177
|
- Fix access to hash members [\#496](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/496) ([mhenrixon](https://github.com/mhenrixon))
|
99
178
|
- Fix cursor assignment [\#494](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/494) ([mhenrixon](https://github.com/mhenrixon))
|
100
179
|
- Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -114,15 +193,12 @@
|
|
114
193
|
**Fixed bugs:**
|
115
194
|
|
116
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))
|
117
197
|
|
118
198
|
## [v7.0.0.beta13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta13) (2020-03-26)
|
119
199
|
|
120
200
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta12...v7.0.0.beta13)
|
121
201
|
|
122
|
-
**Fixed bugs:**
|
123
|
-
|
124
|
-
- Remove digest deletion for concurrent locks [\#482](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/482) ([mhenrixon](https://github.com/mhenrixon))
|
125
|
-
|
126
202
|
## [v7.0.0.beta12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta12) (2020-03-25)
|
127
203
|
|
128
204
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.20...v7.0.0.beta12)
|
@@ -176,6 +252,7 @@
|
|
176
252
|
**Merged pull requests:**
|
177
253
|
|
178
254
|
- README: Use SVG badges ✨ [\#470](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/470) ([olleolleolle](https://github.com/olleolleolle))
|
255
|
+
- remove deprecated/broken OptionsWithFallback\#unique\_type [\#435](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/435) ([zvkemp](https://github.com/zvkemp))
|
179
256
|
|
180
257
|
## [v6.0.19](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.19) (2020-03-21)
|
181
258
|
|
@@ -318,7 +395,6 @@
|
|
318
395
|
**Merged pull requests:**
|
319
396
|
|
320
397
|
- Fix typo and some formatting issues in README [\#442](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/442) ([ajkerr](https://github.com/ajkerr))
|
321
|
-
- remove deprecated/broken OptionsWithFallback\#unique\_type [\#435](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/435) ([zvkemp](https://github.com/zvkemp))
|
322
398
|
|
323
399
|
## [v7.0.0.beta2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta2) (2019-10-08)
|
324
400
|
|
@@ -402,7 +478,7 @@
|
|
402
478
|
**Closed issues:**
|
403
479
|
|
404
480
|
- Unique args in combination with sidekiq cron contains `\_aj\_symbol\_keys` [\#363](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/363)
|
405
|
-
- Low quality
|
481
|
+
- Low quality piece of shit [\#360](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/360)
|
406
482
|
- Passthrough has been deprecated and will be removed in redis-namespace 2.0 [\#338](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/338)
|
407
483
|
|
408
484
|
## [v6.0.12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.12) (2019-02-28)
|
@@ -705,6 +781,7 @@
|
|
705
781
|
- Duplicate jobs getting created [\#257](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/257)
|
706
782
|
- Multiple non-unique jobs with until\_executed? [\#255](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/255)
|
707
783
|
- :until\_executing not unlocking when starting to run [\#245](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/245)
|
784
|
+
- Drop jobs hash [\#282](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/282) ([mhenrixon](https://github.com/mhenrixon))
|
708
785
|
|
709
786
|
**Closed issues:**
|
710
787
|
|
@@ -747,10 +824,6 @@
|
|
747
824
|
- Reject while scheduling [\#273](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/273) ([mhenrixon](https://github.com/mhenrixon))
|
748
825
|
- Improve testing [\#272](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/272) ([mhenrixon](https://github.com/mhenrixon))
|
749
826
|
|
750
|
-
**Fixed bugs:**
|
751
|
-
|
752
|
-
- Drop jobs hash [\#282](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/282) ([mhenrixon](https://github.com/mhenrixon))
|
753
|
-
|
754
827
|
## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
|
755
828
|
|
756
829
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
|
@@ -1159,6 +1232,7 @@
|
|
1159
1232
|
- mock\_redis and the mess [\#62](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/62)
|
1160
1233
|
- What is the exact behavior? [\#47](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/47)
|
1161
1234
|
- Throttling jobs [\#39](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/39)
|
1235
|
+
- undefined method `get\_sidekiq\_options' for "MyScheduledWorker":String [\#27](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/27)
|
1162
1236
|
- Crash handling [\#14](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/14)
|
1163
1237
|
- Missing info from README [\#6](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/6)
|
1164
1238
|
|
@@ -1255,7 +1329,6 @@
|
|
1255
1329
|
- Short jobs are not unique for the given time window [\#33](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/33)
|
1256
1330
|
- Not all sidekiq:sidekiq\_unique keys are removed from Redis [\#31](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/31)
|
1257
1331
|
- What does uniqueness mean in case of this gem? [\#30](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/30)
|
1258
|
-
- undefined method `get\_sidekiq\_options' for "MyScheduledWorker":String [\#27](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/27)
|
1259
1332
|
- Server middleware removes payload hash key before expiration [\#26](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/26)
|
1260
1333
|
- Lock remains when running with Sidekiq::Testing.inline! [\#23](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/23)
|
1261
1334
|
- What is the use case for the uniqueness window? [\#22](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/22)
|
data/README.md
CHANGED
@@ -33,15 +33,27 @@
|
|
33
33
|
- [While Executing](#while-executing)
|
34
34
|
- [Custom Locks](#custom-locks)
|
35
35
|
- [Conflict Strategy](#conflict-strategy)
|
36
|
-
- [
|
37
|
-
- [
|
38
|
-
- [
|
39
|
-
- [
|
40
|
-
- [
|
41
|
-
- [
|
42
|
-
- [
|
43
|
-
- [
|
44
|
-
- [
|
36
|
+
- [log](#log)
|
37
|
+
- [raise](#raise)
|
38
|
+
- [reject](#reject)
|
39
|
+
- [replace](#replace)
|
40
|
+
- [Reschedule](#reschedule)
|
41
|
+
- [Custom Strategies](#custom-strategies)
|
42
|
+
- [Usage](#usage)
|
43
|
+
- [Finer Control over Uniqueness](#finer-control-over-uniqueness)
|
44
|
+
- [After Unlock Callback](#after-unlock-callback)
|
45
|
+
- [Logging](#logging)
|
46
|
+
- [Cleanup Dead Locks](#cleanup-dead-locks)
|
47
|
+
- [Other Sidekiq gems](#other-sidekiq-gems)
|
48
|
+
- [sidekiq-global_id](#sidekiq-global_id)
|
49
|
+
- [Debugging](#debugging)
|
50
|
+
- [Sidekiq Web](#sidekiq-web)
|
51
|
+
- [Show Locks](#show-locks)
|
52
|
+
- [Show Lock](#show-lock)
|
53
|
+
- [Communication](#communication)
|
54
|
+
- [Testing](#testing)
|
55
|
+
- [Unique Sidekiq Configuration](#unique-sidekiq-configuration)
|
56
|
+
- [Uniqueness](#uniqueness)
|
45
57
|
- [Contributing](#contributing)
|
46
58
|
- [Contributors](#contributors)
|
47
59
|
|
@@ -106,6 +118,8 @@ See [Locking & Unlocking](https://github.com/mhenrixon/sidekiq-unique-jobs/wiki/
|
|
106
118
|
|
107
119
|
The gem supports a few different configuration options that might be of interest if you run into some weird issues.
|
108
120
|
|
121
|
+
Configure SidekiqUniqueJobs in an initializer or the sidekiq initializer on application startup.
|
122
|
+
|
109
123
|
```ruby
|
110
124
|
SidekiqUniqueJobs.configure do |config|
|
111
125
|
config.debug_lua = true
|
@@ -189,6 +203,14 @@ On the other hand if I increase it to 10 000 orphaned locks per cleanup (`reaper
|
|
189
203
|
|
190
204
|
> BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE. (Redis::CommandError)
|
191
205
|
|
206
|
+
If you want to disable the reaper set it to `:none`, `nil` or `false`. Actually, any value that isn't `:ruby` or `:lua` will disable the reaping.
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
SidekiqUniqueJobs.config.reaper = :none
|
210
|
+
SidekiqUniqueJobs.config.reaper = nil
|
211
|
+
SidekiqUniqueJobs.config.reaper = false
|
212
|
+
```
|
213
|
+
|
192
214
|
### reaper_count
|
193
215
|
|
194
216
|
```ruby
|
@@ -383,11 +405,9 @@ You can refer on all the locks defined in `lib/sidekiq_unique_jobs/lock/*.rb`.
|
|
383
405
|
|
384
406
|
In order to make it available, you should call in your project startup:
|
385
407
|
|
386
|
-
|
387
|
-
# For rails application
|
388
|
-
# config/initializers/sidekiq_unique_jobs.rb
|
389
|
-
# For other projects, whenever you prefer
|
408
|
+
(For rails application config/initializers/sidekiq_unique_jobs.rb or other projects, wherever you prefer)
|
390
409
|
|
410
|
+
```ruby
|
391
411
|
SidekiqUniqueJobs.configure do |config|
|
392
412
|
config.add_lock :my_custom_lock, Locks::MyCustomLock
|
393
413
|
end
|
@@ -408,7 +428,9 @@ The last one is log which can be be used with the lock `UntilExecuted` and `Unti
|
|
408
428
|
It is possible for locks to have different conflict strategy for the client and server. This is useful for `:until_and_while_executing`.
|
409
429
|
|
410
430
|
```ruby
|
411
|
-
sidekiq_options lock: :until_and_while_executing,
|
431
|
+
sidekiq_options lock: :until_and_while_executing,
|
432
|
+
on_conflict: { client: :log, server: :reject }
|
433
|
+
```
|
412
434
|
|
413
435
|
### log
|
414
436
|
|
@@ -474,11 +496,9 @@ You can refer to all the strategies defined in `lib/sidekiq_unique_jobs/on_confl
|
|
474
496
|
|
475
497
|
In order to make it available, you should call in your project startup:
|
476
498
|
|
477
|
-
|
478
|
-
# For rails application
|
479
|
-
# config/initializers/sidekiq_unique_jobs.rb
|
480
|
-
# For other projects, whenever you prefer
|
499
|
+
(For rails application config/initializers/sidekiq_unique_jobs.rb for other projects, wherever you prefer)
|
481
500
|
|
501
|
+
```ruby
|
482
502
|
SidekiqUniqueJobs.configure do |config|
|
483
503
|
config.add_strategy :my_custom_strategy, Strategies::MyCustomStrategy
|
484
504
|
end
|
@@ -516,7 +536,7 @@ The method or the proc can return a modified version of args without the transie
|
|
516
536
|
class UniqueJobWithFilterMethod
|
517
537
|
include Sidekiq::Worker
|
518
538
|
sidekiq_options lock: :until_and_while_executing,
|
519
|
-
|
539
|
+
lock_args_method: :lock_args # this is default and will be used if such a method is defined
|
520
540
|
|
521
541
|
def self.lock_args(args)
|
522
542
|
[ args[0], args[2][:type] ]
|
@@ -529,7 +549,7 @@ end
|
|
529
549
|
class UniqueJobWithFilterProc
|
530
550
|
include Sidekiq::Worker
|
531
551
|
sidekiq_options lock: :until_executed,
|
532
|
-
|
552
|
+
lock_args_method: ->(args) { [ args.first ] }
|
533
553
|
|
534
554
|
...
|
535
555
|
|
@@ -541,7 +561,7 @@ It is possible to ensure different types of unique args based on context. I can'
|
|
541
561
|
```ruby
|
542
562
|
class UniqueJobWithFilterMethod
|
543
563
|
include Sidekiq::Worker
|
544
|
-
sidekiq_options lock: :until_and_while_executing,
|
564
|
+
sidekiq_options lock: :until_and_while_executing, lock_args_method: :lock_args
|
545
565
|
|
546
566
|
def self.lock_args(args)
|
547
567
|
if Sidekiq::ProcessSet.new.size > 1
|
@@ -562,11 +582,17 @@ If you need to perform any additional work after the lock has been released you
|
|
562
582
|
**Exception 1:** UntilExecuting unlocks and uses callback before yielding.
|
563
583
|
**Exception 2:** UntilExpired expires eventually, no after_unlock hook is called.
|
564
584
|
|
585
|
+
**NOTE:** _It is also possible to write this code as a class method._
|
586
|
+
|
565
587
|
```ruby
|
566
588
|
class UniqueJobWithFilterMethod
|
567
589
|
include Sidekiq::Worker
|
568
590
|
sidekiq_options lock: :while_executing,
|
569
591
|
|
592
|
+
def self.after_unlock
|
593
|
+
# block has yielded and lock is released
|
594
|
+
end
|
595
|
+
|
570
596
|
def after_unlock
|
571
597
|
# block has yielded and lock is released
|
572
598
|
end
|
@@ -596,8 +622,8 @@ For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required
|
|
596
622
|
```ruby
|
597
623
|
class MyWorker
|
598
624
|
sidekiq_retries_exhausted do |msg, _ex|
|
599
|
-
digest = msg['
|
600
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
625
|
+
digest = msg['lock_digest']
|
626
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
601
627
|
end
|
602
628
|
end
|
603
629
|
```
|
@@ -605,11 +631,10 @@ end
|
|
605
631
|
Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
|
606
632
|
|
607
633
|
```ruby
|
608
|
-
# this goes in your initializer
|
609
634
|
Sidekiq.configure_server do |config|
|
610
635
|
config.death_handlers << ->(job, _ex) do
|
611
|
-
digest = job['
|
612
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
636
|
+
digest = job['lock_digest']
|
637
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
613
638
|
end
|
614
639
|
end
|
615
640
|
```
|
@@ -643,7 +668,7 @@ There are several ways of removing keys that are stuck. The prefered way is by u
|
|
643
668
|
To use the web extension you need to require it in your routes.
|
644
669
|
|
645
670
|
```ruby
|
646
|
-
#
|
671
|
+
#app/config/routes.rb
|
647
672
|
require 'sidekiq_unique_jobs/web'
|
648
673
|
mount Sidekiq::Web, at: '/sidekiq'
|
649
674
|
```
|
@@ -674,15 +699,15 @@ Since v7 it is possible to perform some simple validation against your workers s
|
|
674
699
|
Let's take a _bad_ worker:
|
675
700
|
|
676
701
|
```ruby
|
677
|
-
#
|
702
|
+
#app/workers/bad_worker.rb
|
678
703
|
class BadWorker
|
679
704
|
sidekiq_options lock: :while_executing, on_conflict: :replace
|
680
705
|
end
|
681
706
|
|
682
|
-
#
|
707
|
+
#spec/workers/bad_worker_spec.rb
|
683
708
|
|
684
709
|
require "sidekiq_unique_jobs/testing"
|
685
|
-
#
|
710
|
+
#OR
|
686
711
|
require "sidekiq_unique_jobs/rspec/matchers"
|
687
712
|
|
688
713
|
RSpec.describe BadWorker do
|
data/lib/sidekiq_unique_jobs.rb
CHANGED
@@ -26,7 +26,6 @@ require "sidekiq_unique_jobs/connection"
|
|
26
26
|
require "sidekiq_unique_jobs/exceptions"
|
27
27
|
require "sidekiq_unique_jobs/script"
|
28
28
|
require "sidekiq_unique_jobs/script/caller"
|
29
|
-
require "sidekiq_unique_jobs/json"
|
30
29
|
require "sidekiq_unique_jobs/normalizer"
|
31
30
|
require "sidekiq_unique_jobs/job"
|
32
31
|
require "sidekiq_unique_jobs/redis"
|
@@ -6,13 +6,15 @@ module SidekiqUniqueJobs
|
|
6
6
|
#
|
7
7
|
# Command line interface for unique jobs
|
8
8
|
#
|
9
|
-
# @author Mikael Henriksson <mikael@
|
9
|
+
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
10
10
|
#
|
11
11
|
class Cli < Thor
|
12
12
|
# :nodoc:
|
13
|
-
|
13
|
+
# rubocop:disable Style/OptionalBooleanParameter
|
14
|
+
def self.banner(command, _namespace = nil, _subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
|
14
15
|
"jobs #{@package_name} #{command.usage}" # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
|
15
16
|
end
|
17
|
+
# rubocop:enable Style/OptionalBooleanParameter
|
16
18
|
|
17
19
|
desc "list PATTERN", "list all unique digests and their expiry time"
|
18
20
|
option :count, aliases: :c, type: :numeric, default: 1000, desc: "The max number of digests to return"
|