sidekiq-unique-jobs 7.1.8 → 7.1.29

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.

Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +283 -2
  3. data/README.md +17 -14
  4. data/lib/sidekiq_unique_jobs/batch_delete.rb +7 -6
  5. data/lib/sidekiq_unique_jobs/changelog.rb +3 -3
  6. data/lib/sidekiq_unique_jobs/cli.rb +33 -8
  7. data/lib/sidekiq_unique_jobs/config.rb +5 -0
  8. data/lib/sidekiq_unique_jobs/constants.rb +1 -0
  9. data/lib/sidekiq_unique_jobs/digests.rb +5 -5
  10. data/lib/sidekiq_unique_jobs/exceptions.rb +3 -3
  11. data/lib/sidekiq_unique_jobs/expiring_digests.rb +14 -0
  12. data/lib/sidekiq_unique_jobs/key.rb +13 -8
  13. data/lib/sidekiq_unique_jobs/lock/until_executed.rb +5 -1
  14. data/lib/sidekiq_unique_jobs/lock/until_executing.rb +4 -0
  15. data/lib/sidekiq_unique_jobs/lock/until_expired.rb +3 -1
  16. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +4 -1
  17. data/lib/sidekiq_unique_jobs/lock.rb +27 -10
  18. data/lib/sidekiq_unique_jobs/lock_args.rb +19 -15
  19. data/lib/sidekiq_unique_jobs/lock_config.rb +6 -6
  20. data/lib/sidekiq_unique_jobs/lock_digest.rb +7 -7
  21. data/lib/sidekiq_unique_jobs/lock_info.rb +2 -2
  22. data/lib/sidekiq_unique_jobs/lock_timeout.rb +4 -4
  23. data/lib/sidekiq_unique_jobs/lock_ttl.rb +4 -4
  24. data/lib/sidekiq_unique_jobs/locksmith.rb +30 -9
  25. data/lib/sidekiq_unique_jobs/logging.rb +14 -0
  26. data/lib/sidekiq_unique_jobs/lua/lock.lua +15 -9
  27. data/lib/sidekiq_unique_jobs/lua/lock_until_expired.lua +92 -0
  28. data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +31 -3
  29. data/lib/sidekiq_unique_jobs/lua/shared/_common.lua +1 -1
  30. data/lib/sidekiq_unique_jobs/lua/unlock.lua +11 -7
  31. data/lib/sidekiq_unique_jobs/middleware/client.rb +2 -0
  32. data/lib/sidekiq_unique_jobs/middleware/server.rb +2 -0
  33. data/lib/sidekiq_unique_jobs/middleware.rb +4 -4
  34. data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +4 -4
  35. data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +3 -3
  36. data/lib/sidekiq_unique_jobs/options_with_fallback.rb +3 -3
  37. data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
  38. data/lib/sidekiq_unique_jobs/orphans/manager.rb +3 -10
  39. data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +96 -13
  40. data/lib/sidekiq_unique_jobs/redis/string.rb +3 -1
  41. data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +1 -1
  42. data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +10 -0
  43. data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +40 -21
  44. data/lib/sidekiq_unique_jobs/testing.rb +53 -21
  45. data/lib/sidekiq_unique_jobs/timer_task.rb +266 -45
  46. data/lib/sidekiq_unique_jobs/timing.rb +1 -1
  47. data/lib/sidekiq_unique_jobs/upgrade_locks.rb +6 -6
  48. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  49. data/lib/sidekiq_unique_jobs/web/helpers.rb +11 -1
  50. data/lib/sidekiq_unique_jobs/web.rb +22 -3
  51. data/lib/sidekiq_unique_jobs.rb +1 -0
  52. data/lib/tasks/changelog.rake +1 -1
  53. metadata +23 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0525a9235a69f86ef177c23a54afea5977a4a99fe4c09867d88c88d29eeb280
4
- data.tar.gz: f105453b5082cb2a37ff2484e8c92213ec578a488b5f97f894b7f06e901aca23
3
+ metadata.gz: cd565e57b90229451b052d1b49266df3c8e65734059119999279646ee0490939
4
+ data.tar.gz: 77ea82b6eff2660b2b16f5051f4289ac9118d82c7886f339e8e32ac533ecf427
5
5
  SHA512:
6
- metadata.gz: 24eeed23d326f74ebf0c06d34913c8429d1ce7848bdb384606176bf8362ae74f8e1a3dbd0cffad10fbdac1344fe7a1170804e332f5974713c890f6fb330fae91
7
- data.tar.gz: 61ce06ebeb3b49f25dbb3ffb12cfe90f164e9c668756e47b81d527181f66e27a07dc836f5230bb1949ca94429c59bdfe2fa7bc13c3dbac3a53ebe1feb2257080
6
+ metadata.gz: 3bf3b5802219d93dd64064b16f95bfa91ab1b62d12833fad575b82ff82cefd0870073b21f4a4197b0a519cbf343bdc4f60b635ca82a533b38957a76f9afb48c1
7
+ data.tar.gz: ef427d3e5cb07fa6c62e422e9f8ec1116521588f8b1e6019b8c142d7b2da3ee29a12bd61aac13940a7b3f654d22bc2c8cb0f37a5ed85d19ec12deb5868fac73d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,287 @@
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/v7.1.28...HEAD)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - fix\(digests\): ensure consistent digests [\#743](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/743) ([mhenrixon](https://github.com/mhenrixon))
10
+
11
+ **Merged pull requests:**
12
+
13
+ - fix\(after\_unlock\): regression from \#707 [\#737](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/737) ([adamcreekroad](https://github.com/adamcreekroad))
14
+
15
+ ## [v7.1.28](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.28) (2022-11-28)
16
+
17
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.27...v7.1.28)
18
+
19
+ **Fixed bugs:**
20
+
21
+ - Unique Jobs Not Running with Version 7.1.26 [\#730](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/730)
22
+
23
+ **Closed issues:**
24
+
25
+ - Error "undefined method `redis\_info' for Sidekiq:Module" on upgrade [\#740](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/740)
26
+ - spammed by `Nothing to delete; exiting` during spec [\#733](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/733)
27
+
28
+ **Merged pull requests:**
29
+
30
+ - sentence correction [\#744](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/744) ([SupriyaMedankar](https://github.com/SupriyaMedankar))
31
+
32
+ ## [v7.1.27](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.27) (2022-07-30)
33
+
34
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.26...v7.1.27)
35
+
36
+ **Implemented enhancements:**
37
+
38
+ - Feat\(logging\): Allow disabling logging [\#729](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/729) ([mhenrixon](https://github.com/mhenrixon))
39
+
40
+ **Fixed bugs:**
41
+
42
+ - Fix\(namespace\): Prevent self-conflict when redis-namespace is present [\#732](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/732) ([mhenrixon](https://github.com/mhenrixon))
43
+
44
+ **Closed issues:**
45
+
46
+ - Disable logging in Rails testing [\#727](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/727)
47
+ - Memory bloat / dangling keys / reaper not cleaning orphans [\#637](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/637)
48
+
49
+ ## [v7.1.26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.26) (2022-07-28)
50
+
51
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.25...v7.1.26)
52
+
53
+ **Implemented enhancements:**
54
+
55
+ - Fix\(until\_expired\): Fix test and implementation [\#725](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/725) ([mhenrixon](https://github.com/mhenrixon))
56
+
57
+ **Fixed bugs:**
58
+
59
+ - Fix\(until\_and\_while\_executing\): Improve timeouts slightly [\#728](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/728) ([mhenrixon](https://github.com/mhenrixon))
60
+ - Fix\(unlock\): Delete primed keys on last entry [\#726](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/726) ([mhenrixon](https://github.com/mhenrixon))
61
+
62
+ **Merged pull requests:**
63
+
64
+ - Ensure batch delete removes expiring locks [\#724](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/724) ([francesmcmullin](https://github.com/francesmcmullin))
65
+ - Chore: Update dependencies [\#722](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/722) ([mhenrixon](https://github.com/mhenrixon))
66
+ - Move until\_expired digests to separate zset [\#721](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/721) ([francesmcmullin](https://github.com/francesmcmullin))
67
+ - Avoid skipping ranges when looping through queues [\#720](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/720) ([francesmcmullin](https://github.com/francesmcmullin))
68
+ - Bump actions/checkout from 2 to 3 [\#718](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/718) ([dependabot[bot]](https://github.com/apps/dependabot))
69
+ - Add Dependabot for GitHub Actions [\#717](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/717) ([petergoldstein](https://github.com/petergoldstein))
70
+ - Fix Sidekiq::Worker.clear\_all override not being applied [\#714](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/714) ([dsander](https://github.com/dsander))
71
+
72
+ ## [v7.1.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.25) (2022-06-13)
73
+
74
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.24...v7.1.25)
75
+
76
+ **Fixed bugs:**
77
+
78
+ - Fix: Include the correct middleware [\#716](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/716) ([mhenrixon](https://github.com/mhenrixon))
79
+
80
+ ## [v7.1.24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.24) (2022-06-09)
81
+
82
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.23...v7.1.24)
83
+
84
+ **Implemented enhancements:**
85
+
86
+ - Chore: Sidekiq 6.5 compatibility [\#715](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/715) ([mhenrixon](https://github.com/mhenrixon))
87
+
88
+ **Merged pull requests:**
89
+
90
+ - Use sidekiq/testing `Worker.clear` API in sidekiq\_unique\_jobs/testing [\#713](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/713) ([dsander](https://github.com/dsander))
91
+
92
+ ## [v7.1.23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.23) (2022-05-23)
93
+
94
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.22...v7.1.23)
95
+
96
+ **Fixed bugs:**
97
+
98
+ - fix: raise on error [\#712](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/712) ([mhenrixon](https://github.com/mhenrixon))
99
+
100
+ ## [v7.1.22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.22) (2022-05-04)
101
+
102
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.21...v7.1.22)
103
+
104
+ **Fixed bugs:**
105
+
106
+ - Failed jobs waiting to be retried are not considered when fetching uniqueness [\#394](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/394)
107
+ - fix\(locksmith\): execute to yield without arguments [\#710](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/710) ([mhenrixon](https://github.com/mhenrixon))
108
+ - fix: re:lock until\_executing on worker failure [\#709](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/709) ([mhenrixon](https://github.com/mhenrixon))
109
+
110
+ **Closed issues:**
111
+
112
+ - Reviwing: Failed jobs waiting to be retried are not considered when fetching uniqueness [\#708](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/708)
113
+
114
+ ## [v7.1.21](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.21) (2022-04-23)
115
+
116
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.20...v7.1.21)
117
+
118
+ **Implemented enhancements:**
119
+
120
+ - Prepare for Sidekiq v7 [\#707](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/707) ([mhenrixon](https://github.com/mhenrixon))
121
+
122
+ **Closed issues:**
123
+
124
+ - DEPRECATION WARNING: default\_worker\_options is deprecated and will be removed from Sidekiq 7.0 \(use default\_job\_options instead\) \(called from notify\_agents at /Users/hackeron/Development/Tether/timeline/app/models/user.rb:303\) [\#705](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/705)
125
+
126
+ ## [v7.1.20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.20) (2022-04-22)
127
+
128
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.19...v7.1.20)
129
+
130
+ **Implemented enhancements:**
131
+
132
+ - Manually handle timeouts [\#706](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/706) ([mhenrixon](https://github.com/mhenrixon))
133
+
134
+ **Merged pull requests:**
135
+
136
+ - improve README wrt. middleware config [\#704](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/704) ([slhck](https://github.com/slhck))
137
+
138
+ ## [v7.1.19](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.19) (2022-04-09)
139
+
140
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.18...v7.1.19)
141
+
142
+ **Fixed bugs:**
143
+
144
+ - concurrent-ruby 1.1.10 spikes volume of jobs [\#701](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/701)
145
+ - Reimplement the entire TimerTask as it was [\#702](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/702) ([mhenrixon](https://github.com/mhenrixon))
146
+
147
+ ## [v7.1.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.18) (2022-04-05)
148
+
149
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.17...v7.1.18)
150
+
151
+ **Implemented enhancements:**
152
+
153
+ - Make sure we reflect on execution failure [\#700](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/700) ([mhenrixon](https://github.com/mhenrixon))
154
+
155
+ ## [v7.1.17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.17) (2022-04-05)
156
+
157
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.16...v7.1.17)
158
+
159
+ ## [v7.1.16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.16) (2022-04-02)
160
+
161
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.15...v7.1.16)
162
+
163
+ **Implemented enhancements:**
164
+
165
+ - Abort Ruby Reaper when sidekiq queues are full [\#690](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/690) ([francesmcmullin](https://github.com/francesmcmullin))
166
+ - Quote '3.0' to ensure CI uses Ruby 3.0.x for the 3.0 entry [\#689](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/689) ([petergoldstein](https://github.com/petergoldstein))
167
+
168
+ **Fixed bugs:**
169
+
170
+ - Hotfix: Ensure consistent lock args [\#699](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/699) ([mhenrixon](https://github.com/mhenrixon))
171
+ - Expire older changelog entries first [\#698](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/698) ([mhenrixon](https://github.com/mhenrixon))
172
+ - Fix drift [\#688](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/688) ([mhenrixon](https://github.com/mhenrixon))
173
+
174
+ **Closed issues:**
175
+
176
+ - concurrent-ruby has dropped support for TimerTask timeouts [\#697](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/697)
177
+ - Most recent changelogs are removed first [\#696](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/696)
178
+ - Improve README slightly [\#694](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/694)
179
+ - locksmith.rb:327: NoMethodError: undefined method `+' for nil:NilClass [\#686](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/686)
180
+ - lock\_timeout cannot be nil [\#675](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/675)
181
+ - Skip reaping when queues are too large [\#670](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/670)
182
+
183
+ **Merged pull requests:**
184
+
185
+ - Improve readme [\#695](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/695) ([fwolfst](https://github.com/fwolfst))
186
+ - Add funding\_uri to gemspec [\#693](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/693) ([fwolfst](https://github.com/fwolfst))
187
+ - Fix worker validator [\#685](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/685) ([victorfgs](https://github.com/victorfgs))
188
+
189
+ ## [v7.1.15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.15) (2022-02-10)
190
+
191
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.14...v7.1.15)
192
+
193
+ **Merged pull requests:**
194
+
195
+ - Fixing reschedule when using a non default queue [\#679](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/679) ([bigzed](https://github.com/bigzed))
196
+
197
+ ## [v7.1.14](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.14) (2022-02-04)
198
+
199
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.13...v7.1.14)
200
+
201
+ **Implemented enhancements:**
202
+
203
+ - Fix the remaining deprecation warnings [\#681](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/681) ([mhenrixon](https://github.com/mhenrixon))
204
+
205
+ ## [v7.1.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.13) (2022-02-03)
206
+
207
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.12...v7.1.13)
208
+
209
+ **Implemented enhancements:**
210
+
211
+ - Prepare for redis 5.0.0 [\#680](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/680) ([mhenrixon](https://github.com/mhenrixon))
212
+
213
+ **Fixed bugs:**
214
+
215
+ - Fix homepage url [\#667](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/667) ([dal-ioki](https://github.com/dal-ioki))
216
+
217
+ **Closed issues:**
218
+
219
+ - Job finished, but lock is not cleared [\#677](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/677)
220
+ - sidekiq\_options lock conflicts with sidekiq-lock gem lock option [\#669](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/669)
221
+ - Slow evalsha causing timeouts [\#668](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/668)
222
+ - Inconsistent documentation for config validation [\#647](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/647)
223
+
224
+ **Merged pull requests:**
225
+
226
+ - Bump bundler and friends [\#674](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/674) ([mhenrixon](https://github.com/mhenrixon))
227
+ - readme: fix minitest assertion. [\#672](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/672) ([crondaemon](https://github.com/crondaemon))
228
+ - Pass `item` in `after_unlock` callback [\#665](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/665) ([piloos](https://github.com/piloos))
229
+
230
+ ## [v7.1.12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.12) (2021-12-01)
231
+
232
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.11...v7.1.12)
233
+
234
+ **Implemented enhancements:**
235
+
236
+ - Improve Ruby Reaper performance under heavy load [\#663](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/663)
237
+ - Improve reaper performance under heavy load [\#666](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/666) ([mhenrixon](https://github.com/mhenrixon))
238
+
239
+ ## [v7.1.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.11) (2021-11-30)
240
+
241
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.10...v7.1.11)
242
+
243
+ **Fixed bugs:**
244
+
245
+ - Fix ruby reaper edge case [\#661](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/661) ([mhenrixon](https://github.com/mhenrixon))
246
+
247
+ **Closed issues:**
248
+
249
+ - Question: Wait instead of cancelling if it is executing? [\#655](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/655)
250
+ - Expired Locks remain in zset of digests \[using "until\_expired" lock\] [\#653](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/653)
251
+ - \[Q&A\] Performance & Dead Locks [\#652](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/652)
252
+ - Sidekiq 6.3.0 includes Job module that clashes with sidekiq\_unique\_ext.rb class Job [\#651](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/651)
253
+
254
+ ## [v7.1.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.10) (2021-10-18)
255
+
256
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.8...v7.1.10)
257
+
258
+ **Fixed bugs:**
259
+
260
+ - "IndexError: string not matched" when job is replaced on client [\#635](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/635)
261
+
262
+ **Merged pull requests:**
263
+
264
+ - Update URL for Sidekiq's Enterprise unique jobs [\#648](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/648) ([jsantos](https://github.com/jsantos))
265
+
266
+ ## [v7.1.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.8) (2021-10-08)
267
+
268
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.13...v7.1.8)
269
+
270
+ **Fixed bugs:**
271
+
272
+ - undefined method `delete' for class `Sidekiq::Job' [\#634](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/634)
273
+ - INFO keys not persisted when job is enqueued [\#602](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/602)
274
+ - lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
275
+ - Prevent too eager cleanup of lock info [\#645](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/645) ([mhenrixon](https://github.com/mhenrixon))
276
+
277
+ **Closed issues:**
278
+
279
+ - Compatibility with unreleased Sidekiq 6.3.0 [\#636](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/636)
280
+
281
+ **Merged pull requests:**
282
+
283
+ - Update docs [\#644](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/644) ([andypple](https://github.com/andypple))
284
+
3
285
  ## [v7.0.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.13) (2021-09-27)
4
286
 
5
287
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.7...v7.0.13)
@@ -90,7 +372,7 @@
90
372
  **Implemented enhancements:**
91
373
 
92
374
  - Reflections [\#611](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/611) ([mhenrixon](https://github.com/mhenrixon))
93
- - Start new orphan reaper process if orphan reaper is not running [\#604](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/604) ([Assa1121](https://github.com/Assa1121))
375
+ - Start new orphan reaper process if orphan reaper is not running [\#604](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/604) ([AlexFlint73](https://github.com/AlexFlint73))
94
376
 
95
377
  **Fixed bugs:**
96
378
 
@@ -236,7 +518,6 @@
236
518
  - Tasks run once, and then there is no launch [\#464](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/464)
237
519
  - Jobs executing and immediately returning [\#418](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/418)
238
520
  - until\_and\_while\_executing + sidekiq retry mechanism [\#395](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/395)
239
- - Failed jobs waiting to be retried are not considered when fetching uniqueness [\#394](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/394)
240
521
  - Fix that :PRIMED keys are seemingly not removed [\#574](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/574) ([mhenrixon](https://github.com/mhenrixon))
241
522
 
242
523
  **Closed issues:**
data/README.md CHANGED
@@ -31,7 +31,7 @@ Want to show me some ❤️ for the hard work I do on this gem? You can use the
31
31
  - [raise](#raise)
32
32
  - [reject](#reject)
33
33
  - [replace](#replace)
34
- - [Reschedule](#reschedule)
34
+ - [reschedule](#reschedule)
35
35
  - [Custom Strategies](#custom-strategies)
36
36
  - [3 Cleanup Dead Locks](#3-cleanup-dead-locks)
37
37
  - [Debugging](#debugging)
@@ -90,7 +90,7 @@ Want to show me some ❤️ for the hard work I do on this gem? You can use the
90
90
 
91
91
  This gem adds unique constraints to sidekiq jobs. The uniqueness is achieved by creating a set of keys in redis based off of `queue`, `class`, `args` (in the sidekiq job hash).
92
92
 
93
- By default, only one lock for a given hash can be acquired. What happens when a lock can't be acquired is governed by a chosen [Conflict Strategy](#conflict-strategy) strategy. Unless a conflict strategy is chosen
93
+ By default, only one lock for a given hash can be acquired. What happens when a lock can't be acquired is governed by a chosen [Conflict Strategy](#conflict-strategy) strategy. Unless a conflict strategy is chosen (?)
94
94
 
95
95
  This is the documentation for the `main` branch. You can find the documentation for each release by navigating to its tag.
96
96
 
@@ -123,9 +123,11 @@ Before v7, the middleware was configured automatically. Since some people report
123
123
 
124
124
  *NOTE* if you want to use the reaper you also need to configure the server middleware.
125
125
 
126
- [A full example](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/initializers/sidekiq.rb#L12)
126
+ The following shows how to modify your `config/initializers/sidekiq.rb` file to use the middleware. [Here is a full example.](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/initializers/sidekiq.rb#L12)
127
127
 
128
128
  ```ruby
129
+ require "sidekiq-unique-jobs"
130
+
129
131
  Sidekiq.configure_server do |config|
130
132
  config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }
131
133
 
@@ -151,7 +153,7 @@ end
151
153
 
152
154
  ### Your first worker
153
155
 
154
- The most likely to be used worker is `:until_executed`. This type of lock creates a lock from when `UntilExecutedWorker.perform_async` is called until right after `UntilExecutedWorker.new.perform` has been called.
156
+ The lock type most likely to be is `:until_executed`. This type of lock creates a lock from when `UntilExecutedWorker.perform_async` is called until right after `UntilExecutedWorker.new.perform` has been called.
155
157
 
156
158
  ```ruby
157
159
  # frozen_string_literal: true
@@ -159,8 +161,7 @@ The most likely to be used worker is `:until_executed`. This type of lock create
159
161
  class UntilExecutedWorker
160
162
  include Sidekiq::Worker
161
163
 
162
- sidekiq_options queue: :until_executed,
163
- lock: :until_executed
164
+ sidekiq_options lock: :until_executed
164
165
 
165
166
  def perform
166
167
  logger.info("cowboy")
@@ -346,9 +347,9 @@ Please not that if you try to override a default lock, an `ArgumentError` will b
346
347
 
347
348
  ## Conflict Strategy
348
349
 
349
- Decides how we handle conflict. We can either reject the job to the dead queue or reschedule it. Both are useful for jobs that absolutely need to run and have been configured to use the lock `WhileExecuting` that is used only by the sidekiq server process.
350
+ Decides how we handle conflict. We can either `reject` the job to the dead queue or `reschedule` it. Both are useful for jobs that absolutely need to run and have been configured to use the lock `WhileExecuting` that is used only by the sidekiq server process.
350
351
 
351
- The last one is log which can be be used with the lock `UntilExecuted` and `UntilExpired`. Now we write a log entry saying the job could not be pushed because it is a duplicate of another job with the same arguments.
352
+ Furthermore, `log` can be be used with the lock `UntilExecuted` and `UntilExpired`. Now we write a log entry saying the job could not be pushed because it is a duplicate of another job with the same arguments.
352
353
 
353
354
  It is possible for locks to have different conflict strategy for the client and server. This is useful for `:until_and_while_executing`.
354
355
 
@@ -363,7 +364,7 @@ sidekiq_options lock: :until_and_while_executing,
363
364
  sidekiq_options on_conflict: :log
364
365
  ```
365
366
 
366
- This strategy is intended to be used with `UntilExecuted` and `UntilExpired`. It will log a line about that this is job is a duplicate of another.
367
+ This strategy is intended to be used with `UntilExecuted` and `UntilExpired`. It will log a line that this job is a duplicate of another.
367
368
 
368
369
  ### raise
369
370
 
@@ -394,7 +395,7 @@ queue and retry the lock again.
394
395
  This is slightly dangerous and should probably only be used for jobs that are
395
396
  always scheduled in the future. Currently only attempting to retry one time.
396
397
 
397
- ### Reschedule
398
+ ### reschedule
398
399
 
399
400
  ```ruby
400
401
  sidekiq_options on_conflict: :reschedule
@@ -568,7 +569,7 @@ The reason this happens is that the server couldn't find a valid sidekiq worker
568
569
 
569
570
  ### Validating Worker Configuration
570
571
 
571
- Since v7 it is possible to perform some simple validation against your workers sidekiq_options. What it does is scan for some issues that are known to cause problems in production.
572
+ Since v7 it is possible to perform some simple validation against your workers `sidekiq_options`. What it does is scan for some issues that are known to cause problems in production.
572
573
 
573
574
  Let's take a _bad_ worker:
574
575
 
@@ -599,16 +600,17 @@ Expected BadWorker to have valid sidekiq options but found the following problem
599
600
  If you are not using RSpec (a lot of people prefer minitest or test unit) you can do something like:
600
601
 
601
602
  ```ruby
602
- assert SidekiqUniqueJobs.validate_worker!(BadWorker.get_sidekiq_options)
603
+ assert_raise(InvalidWorker){ SidekiqUniqueJobs.validate_worker!(BadWorker.get_sidekiq_options) }
603
604
  ```
604
605
 
605
606
  ### Uniqueness
606
607
 
607
- This has been probably the most confusing part of this gem. People get really confused with how unreliable the unique jobs have been. I there for decided to do what Mike is doing for sidekiq enterprise. Read the section about unique jobs: [Enterprise unique jobs][]
608
+ This has been probably the most confusing part of this gem. People get really confused with how unreliable the unique jobs have been. I there for decided to do what Mike is doing for sidekiq enterprise. Read the section about unique jobs: [Enterprise unique jobs][](?)
608
609
 
609
610
  ```ruby
610
611
  SidekiqUniqueJobs.configure do |config|
611
612
  config.enabled = !Rails.env.test?
613
+ config.logger_enabled = !Rails.env.test?
612
614
  end
613
615
  ```
614
616
 
@@ -735,6 +737,7 @@ Configure SidekiqUniqueJobs in an initializer or the sidekiq initializer on appl
735
737
  ```ruby
736
738
  SidekiqUniqueJobs.configure do |config|
737
739
  config.logger = Sidekiq.logger # default, change at your own discretion
740
+ config.logger_enabled = true # default, disable for test environments
738
741
  config.debug_lua = false # Turn on when debugging
739
742
  config.lock_info = false # Turn on when debugging
740
743
  config.lock_ttl = 600 # Expire locks after 10 minutes
@@ -1043,7 +1046,7 @@ There is a [![Join the chat at https://gitter.im/mhenrixon/sidekiq-unique-jobs](
1043
1046
 
1044
1047
  You can find a list of contributors over on [Contributors][]
1045
1048
 
1046
- [Enterprise unique jobs]: https://www.dailydrip.com/topics/sidekiq/drips/sidekiq-enterprise-unique-jobs
1049
+ [Enterprise unique jobs]: https://github.com/mperham/sidekiq/wiki/Ent-Unique-Jobs
1047
1050
  [Contributors]: https://github.com/mhenrixon/sidekiq-unique-jobs/graphs/contributors
1048
1051
  [v4.0.18]: https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18
1049
1052
  [v5.0.10]: https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10.
@@ -87,10 +87,11 @@ module SidekiqUniqueJobs
87
87
  #
88
88
  def batch_delete(conn)
89
89
  digests.each_slice(BATCH_SIZE) do |chunk|
90
- conn.pipelined do
90
+ conn.pipelined do |pipeline|
91
91
  chunk.each do |digest|
92
- del_digest(conn, digest)
93
- conn.zrem(SidekiqUniqueJobs::DIGESTS, digest)
92
+ del_digest(pipeline, digest)
93
+ pipeline.zrem(SidekiqUniqueJobs::DIGESTS, digest)
94
+ pipeline.zrem(SidekiqUniqueJobs::EXPIRING_DIGESTS, digest)
94
95
  @count += 1
95
96
  end
96
97
  end
@@ -99,13 +100,13 @@ module SidekiqUniqueJobs
99
100
  @count
100
101
  end
101
102
 
102
- def del_digest(conn, digest)
103
+ def del_digest(pipeline, digest)
103
104
  removable_keys = keys_for_digest(digest)
104
105
 
105
106
  if VersionCheck.satisfied?(redis_version, ">= 4.0.0")
106
- conn.unlink(*removable_keys)
107
+ pipeline.unlink(*removable_keys)
107
108
  else
108
- conn.del(*removable_keys)
109
+ pipeline.del(*removable_keys)
109
110
  end
110
111
  end
111
112
 
@@ -62,9 +62,9 @@ module SidekiqUniqueJobs
62
62
  #
63
63
  def page(cursor: 0, pattern: "*", page_size: 100)
64
64
  redis do |conn|
65
- total_size, result = conn.multi do
66
- conn.zcard(key)
67
- conn.zscan(key, cursor, match: pattern, count: page_size)
65
+ total_size, result = conn.multi do |pipeline|
66
+ pipeline.zcard(key)
67
+ pipeline.zscan(key, cursor, match: pattern, count: page_size)
68
68
  end
69
69
 
70
70
  [
@@ -20,9 +20,11 @@ module SidekiqUniqueJobs
20
20
  option :count, aliases: :c, type: :numeric, default: 1000, desc: "The max number of digests to return"
21
21
  # :nodoc:
22
22
  def list(pattern = "*")
23
- entries = digests.entries(pattern: pattern, count: options[:count])
24
- say "Found #{entries.size} digests matching '#{pattern}':"
25
- print_in_columns(entries.sort) if entries.any?
23
+ max_count = options[:count]
24
+ say "Searching for regular digests"
25
+ list_entries(digests.entries(pattern: pattern, count: max_count), pattern)
26
+ say "Searching for expiring digests"
27
+ list_entries(expiring_digests.entries(pattern: pattern, count: max_count), pattern)
26
28
  end
27
29
 
28
30
  desc "del PATTERN", "deletes unique digests from redis by pattern"
@@ -32,11 +34,9 @@ module SidekiqUniqueJobs
32
34
  def del(pattern)
33
35
  max_count = options[:count]
34
36
  if options[:dry_run]
35
- result = digests.entries(pattern: pattern, count: max_count)
36
- say "Would delete #{result.size} digests matching '#{pattern}'"
37
+ count_entries_for_del(max_count, pattern)
37
38
  else
38
- deleted_count = digests.delete_by_pattern(pattern, count: max_count)
39
- say "Deleted #{deleted_count} digests matching '#{pattern}'"
39
+ del_entries(max_count, pattern)
40
40
  end
41
41
  end
42
42
 
@@ -51,12 +51,17 @@ module SidekiqUniqueJobs
51
51
  console_class.start
52
52
  end
53
53
 
54
- no_commands do
54
+ no_commands do # rubocop:disable Metrics/BlockLength
55
55
  # :nodoc:
56
56
  def digests
57
57
  @digests ||= SidekiqUniqueJobs::Digests.new
58
58
  end
59
59
 
60
+ # :nodoc:
61
+ def expiring_digests
62
+ @expiring_digests ||= SidekiqUniqueJobs::ExpiringDigests.new
63
+ end
64
+
60
65
  # :nodoc:
61
66
  def console_class
62
67
  require "pry"
@@ -65,6 +70,26 @@ module SidekiqUniqueJobs
65
70
  require "irb"
66
71
  IRB
67
72
  end
73
+
74
+ # :nodoc:
75
+ def list_entries(entries, pattern)
76
+ say "Found #{entries.size} digests matching '#{pattern}':"
77
+ print_in_columns(entries.sort) if entries.any?
78
+ end
79
+
80
+ # :nodoc:
81
+ def count_entries_for_del(max_count, pattern)
82
+ count = digests.entries(pattern: pattern, count: max_count).size +
83
+ expiring_digests.entries(pattern: pattern, count: max_count).size
84
+ say "Would delete #{count} digests matching '#{pattern}'"
85
+ end
86
+
87
+ # :nodoc:
88
+ def del_entries(max_count, pattern)
89
+ deleted_count = digests.delete_by_pattern(pattern, count: max_count).to_i +
90
+ expiring_digests.delete_by_pattern(pattern, count: max_count).to_i
91
+ say "Deleted #{deleted_count} digests matching '#{pattern}'"
92
+ end
68
93
  end
69
94
  end
70
95
  end
@@ -8,6 +8,7 @@ module SidekiqUniqueJobs
8
8
  :enabled,
9
9
  :lock_prefix,
10
10
  :logger,
11
+ :logger_enabled,
11
12
  :locks,
12
13
  :strategies,
13
14
  :debug_lua,
@@ -91,6 +92,9 @@ module SidekiqUniqueJobs
91
92
  # @return [nil]
92
93
  LOCK_TTL = nil
93
94
  #
95
+ # @return [true,false] by default false (don't disable logger)
96
+ LOGGER_ENABLED = true
97
+ #
94
98
  # @return [true] by default the gem is enabled
95
99
  ENABLED = true
96
100
  #
@@ -180,6 +184,7 @@ module SidekiqUniqueJobs
180
184
  ENABLED,
181
185
  PREFIX,
182
186
  Sidekiq.logger,
187
+ LOGGER_ENABLED,
183
188
  LOCKS,
184
189
  STRATEGIES,
185
190
  DEBUG_LUA,
@@ -14,6 +14,7 @@ module SidekiqUniqueJobs
14
14
  CREATED_AT = "created_at"
15
15
  DEAD_VERSION = "uniquejobs:dead"
16
16
  DIGESTS = "uniquejobs:digests"
17
+ EXPIRING_DIGESTS = "uniquejobs:expiring_digests"
17
18
  ERRORS = "errors"
18
19
  JID = "jid"
19
20
  LIMIT = "limit"
@@ -14,8 +14,8 @@ module SidekiqUniqueJobs
14
14
  # @return [String] the default pattern to use for matching
15
15
  SCAN_PATTERN = "*"
16
16
 
17
- def initialize
18
- super(DIGESTS)
17
+ def initialize(digests_key = DIGESTS)
18
+ super(digests_key)
19
19
  end
20
20
 
21
21
  #
@@ -95,9 +95,9 @@ module SidekiqUniqueJobs
95
95
  #
96
96
  def page(cursor: 0, pattern: SCAN_PATTERN, page_size: 100)
97
97
  redis do |conn|
98
- total_size, digests = conn.multi do
99
- conn.zcard(key)
100
- conn.zscan(key, cursor, match: pattern, count: page_size)
98
+ total_size, digests = conn.multi do |pipeline|
99
+ pipeline.zcard(key)
100
+ pipeline.zscan(key, cursor, match: pattern, count: page_size)
101
101
  end
102
102
 
103
103
  [
@@ -72,14 +72,14 @@ module SidekiqUniqueJobs
72
72
  class InvalidUniqueArguments < UniqueJobsError
73
73
  def initialize(options)
74
74
  given = options[:given]
75
- worker_class = options[:worker_class]
75
+ job_class = options[:job_class]
76
76
  lock_args_method = options[:lock_args_method]
77
- lock_args_meth = worker_class.method(lock_args_method)
77
+ lock_args_meth = job_class.method(lock_args_method)
78
78
  num_args = lock_args_meth.arity
79
79
  source_location = lock_args_meth.source_location
80
80
 
81
81
  super(
82
- "#{worker_class}##{lock_args_method} takes #{num_args} arguments, received #{given.inspect}" \
82
+ "#{job_class}##{lock_args_method} takes #{num_args} arguments, received #{given.inspect}" \
83
83
  "\n\n" \
84
84
  " #{source_location.join(':')}"
85
85
  )