sidekiq-unique-jobs 7.1.8 → 8.0.3
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 +331 -2
- data/README.md +28 -25
- data/lib/sidekiq_unique_jobs/batch_delete.rb +7 -10
- data/lib/sidekiq_unique_jobs/changelog.rb +7 -17
- data/lib/sidekiq_unique_jobs/cli.rb +33 -8
- data/lib/sidekiq_unique_jobs/config.rb +5 -0
- data/lib/sidekiq_unique_jobs/connection.rb +4 -7
- data/lib/sidekiq_unique_jobs/constants.rb +1 -0
- data/lib/sidekiq_unique_jobs/core_ext.rb +1 -1
- data/lib/sidekiq_unique_jobs/digests.rb +7 -17
- data/lib/sidekiq_unique_jobs/exceptions.rb +3 -3
- data/lib/sidekiq_unique_jobs/expiring_digests.rb +14 -0
- data/lib/sidekiq_unique_jobs/job.rb +6 -1
- data/lib/sidekiq_unique_jobs/key.rb +13 -8
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +6 -1
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +4 -0
- data/lib/sidekiq_unique_jobs/lock/until_expired.rb +3 -1
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +5 -3
- data/lib/sidekiq_unique_jobs/lock.rb +32 -12
- data/lib/sidekiq_unique_jobs/lock_args.rb +19 -15
- data/lib/sidekiq_unique_jobs/lock_config.rb +6 -6
- data/lib/sidekiq_unique_jobs/lock_digest.rb +7 -7
- data/lib/sidekiq_unique_jobs/lock_info.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +4 -4
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +4 -4
- data/lib/sidekiq_unique_jobs/lock_type.rb +37 -0
- data/lib/sidekiq_unique_jobs/locksmith.rb +36 -13
- data/lib/sidekiq_unique_jobs/logging.rb +14 -0
- data/lib/sidekiq_unique_jobs/lua/delete.lua +3 -6
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +3 -6
- data/lib/sidekiq_unique_jobs/lua/delete_job_by_digest.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/find_digest_in_queues.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/lock.lua +16 -10
- data/lib/sidekiq_unique_jobs/lua/lock_until_expired.lua +92 -0
- data/lib/sidekiq_unique_jobs/lua/locked.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/queue.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +33 -8
- data/lib/sidekiq_unique_jobs/lua/shared/_common.lua +1 -6
- data/lib/sidekiq_unique_jobs/lua/shared/_delete_from_sorted_set.lua +1 -0
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/unlock.lua +16 -15
- data/lib/sidekiq_unique_jobs/lua/update_version.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/upgrade.lua +1 -3
- data/lib/sidekiq_unique_jobs/middleware/client.rb +2 -0
- data/lib/sidekiq_unique_jobs/middleware/server.rb +2 -0
- data/lib/sidekiq_unique_jobs/middleware.rb +4 -4
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +0 -43
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +3 -3
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +4 -4
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +6 -13
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +95 -16
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +9 -2
- data/lib/sidekiq_unique_jobs/redis/string.rb +3 -1
- data/lib/sidekiq_unique_jobs/reflections.rb +1 -1
- data/lib/sidekiq_unique_jobs/script/caller.rb +14 -8
- data/lib/sidekiq_unique_jobs/server.rb +0 -1
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +1 -1
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +14 -4
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +40 -21
- data/lib/sidekiq_unique_jobs/testing.rb +53 -21
- data/lib/sidekiq_unique_jobs/timer_task.rb +266 -45
- data/lib/sidekiq_unique_jobs/timing.rb +1 -1
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +11 -14
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/web/helpers.rb +15 -3
- data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +44 -38
- data/lib/sidekiq_unique_jobs/web/views/lock.erb +5 -3
- data/lib/sidekiq_unique_jobs/web/views/locks.erb +42 -37
- data/lib/sidekiq_unique_jobs/web.rb +26 -8
- data/lib/sidekiq_unique_jobs.rb +2 -0
- data/lib/tasks/changelog.rake +1 -1
- metadata +16 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2462acb2448a07c45eb8a1789239f859a09e079cff316fe61dc205d9ea8856a4
|
4
|
+
data.tar.gz: 57449a594cd034c79001815883806098e04a92869c41cbe6044c90ab6f1fa3ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b200d3544047b6080147b19b71ffd83a0ac42087ed29f1d84fb35b226b1418f50e37c94b309a946504c32d26b11b5fd173ade85e77c568931d33b948f1c656f9
|
7
|
+
data.tar.gz: 9d12cbf3317acd4e5bd6d934616622e5ac3336ecba4e51b2b29fbf6782deab2b1af291af1471e16da7271fef42b33804b7a3c7f3475016de88bd75e2d0668684
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,335 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v8.0.2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.2) (2023-03-13)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.1...v8.0.2)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Missing v7.1 branch? [\#757](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/757)
|
10
|
+
- Allow one running job but at most one job in the queue [\#748](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/748)
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- update debug\_lua check to match passed in arg type [\#765](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/765) ([JeremiahChurch](https://github.com/JeremiahChurch))
|
15
|
+
- fix rubocop [\#764](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/764) ([JeremiahChurch](https://github.com/JeremiahChurch))
|
16
|
+
- Hide lock info debug suggestion on lock page if it's already enabled. [\#763](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/763) ([JeremiahChurch](https://github.com/JeremiahChurch))
|
17
|
+
- fix lock & changelog times on web interface [\#762](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/762) ([JeremiahChurch](https://github.com/JeremiahChurch))
|
18
|
+
|
19
|
+
## [v8.0.1](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.1) (2023-02-14)
|
20
|
+
|
21
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.0...v8.0.1)
|
22
|
+
|
23
|
+
**Closed issues:**
|
24
|
+
|
25
|
+
- TypeError: Unsupported command argument type: ActiveSupport::Duration [\#754](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/754)
|
26
|
+
- Incompatibility with Sidekiq 7 [\#736](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/736)
|
27
|
+
|
28
|
+
**Merged pull requests:**
|
29
|
+
|
30
|
+
- Fix active worker detection by using correct keys [\#756](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/756) ([dodo121](https://github.com/dodo121))
|
31
|
+
- Fix minor typo in drift\_reaper\_interval comment [\#755](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/755) ([lazyatom](https://github.com/lazyatom))
|
32
|
+
|
33
|
+
## [v8.0.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.0) (2023-01-30)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.29...v8.0.0)
|
36
|
+
|
37
|
+
**Implemented enhancements:**
|
38
|
+
|
39
|
+
- chore\(deps\): upgrade rails app [\#753](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/753) ([mhenrixon](https://github.com/mhenrixon))
|
40
|
+
- feat: sidekiq v7 support [\#751](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/751) ([mhenrixon](https://github.com/mhenrixon))
|
41
|
+
|
42
|
+
**Closed issues:**
|
43
|
+
|
44
|
+
- Support for redis 5 [\#752](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/752)
|
45
|
+
- while\_executing jobs being dropped [\#749](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/749)
|
46
|
+
|
47
|
+
**Merged pull requests:**
|
48
|
+
|
49
|
+
- fix: backport the fix for the return value of \#deep\_transform\_keys [\#750](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/750) ([fixtheclouds](https://github.com/fixtheclouds))
|
50
|
+
|
51
|
+
## [v7.1.29](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.29) (2022-12-03)
|
52
|
+
|
53
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.28...v7.1.29)
|
54
|
+
|
55
|
+
**Fixed bugs:**
|
56
|
+
|
57
|
+
- fix\(digests\): ensure consistent digests [\#743](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/743) ([mhenrixon](https://github.com/mhenrixon))
|
58
|
+
|
59
|
+
**Merged pull requests:**
|
60
|
+
|
61
|
+
- fix\(after\_unlock\): regression from \#707 [\#737](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/737) ([adamcreekroad](https://github.com/adamcreekroad))
|
62
|
+
|
63
|
+
## [v7.1.28](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.28) (2022-11-28)
|
64
|
+
|
65
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.27...v7.1.28)
|
66
|
+
|
67
|
+
**Fixed bugs:**
|
68
|
+
|
69
|
+
- Unique Jobs Not Running with Version 7.1.26 [\#730](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/730)
|
70
|
+
|
71
|
+
**Closed issues:**
|
72
|
+
|
73
|
+
- Error "undefined method `redis\_info' for Sidekiq:Module" on upgrade [\#740](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/740)
|
74
|
+
- spammed by `Nothing to delete; exiting` during spec [\#733](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/733)
|
75
|
+
|
76
|
+
**Merged pull requests:**
|
77
|
+
|
78
|
+
- sentence correction [\#744](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/744) ([SupriyaMedankar](https://github.com/SupriyaMedankar))
|
79
|
+
|
80
|
+
## [v7.1.27](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.27) (2022-07-30)
|
81
|
+
|
82
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.26...v7.1.27)
|
83
|
+
|
84
|
+
**Implemented enhancements:**
|
85
|
+
|
86
|
+
- Feat\(logging\): Allow disabling logging [\#729](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/729) ([mhenrixon](https://github.com/mhenrixon))
|
87
|
+
|
88
|
+
**Fixed bugs:**
|
89
|
+
|
90
|
+
- 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))
|
91
|
+
|
92
|
+
**Closed issues:**
|
93
|
+
|
94
|
+
- Disable logging in Rails testing [\#727](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/727)
|
95
|
+
- Memory bloat / dangling keys / reaper not cleaning orphans [\#637](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/637)
|
96
|
+
|
97
|
+
## [v7.1.26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.26) (2022-07-28)
|
98
|
+
|
99
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.25...v7.1.26)
|
100
|
+
|
101
|
+
**Implemented enhancements:**
|
102
|
+
|
103
|
+
- Fix\(until\_expired\): Fix test and implementation [\#725](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/725) ([mhenrixon](https://github.com/mhenrixon))
|
104
|
+
|
105
|
+
**Fixed bugs:**
|
106
|
+
|
107
|
+
- Fix\(until\_and\_while\_executing\): Improve timeouts slightly [\#728](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/728) ([mhenrixon](https://github.com/mhenrixon))
|
108
|
+
- Fix\(unlock\): Delete primed keys on last entry [\#726](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/726) ([mhenrixon](https://github.com/mhenrixon))
|
109
|
+
|
110
|
+
**Merged pull requests:**
|
111
|
+
|
112
|
+
- Ensure batch delete removes expiring locks [\#724](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/724) ([francesmcmullin](https://github.com/francesmcmullin))
|
113
|
+
- Chore: Update dependencies [\#722](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/722) ([mhenrixon](https://github.com/mhenrixon))
|
114
|
+
- Move until\_expired digests to separate zset [\#721](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/721) ([francesmcmullin](https://github.com/francesmcmullin))
|
115
|
+
- Avoid skipping ranges when looping through queues [\#720](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/720) ([francesmcmullin](https://github.com/francesmcmullin))
|
116
|
+
- Bump actions/checkout from 2 to 3 [\#718](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/718) ([dependabot[bot]](https://github.com/apps/dependabot))
|
117
|
+
- Add Dependabot for GitHub Actions [\#717](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/717) ([petergoldstein](https://github.com/petergoldstein))
|
118
|
+
- Fix Sidekiq::Worker.clear\_all override not being applied [\#714](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/714) ([dsander](https://github.com/dsander))
|
119
|
+
|
120
|
+
## [v7.1.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.25) (2022-06-13)
|
121
|
+
|
122
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.24...v7.1.25)
|
123
|
+
|
124
|
+
**Fixed bugs:**
|
125
|
+
|
126
|
+
- Fix: Include the correct middleware [\#716](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/716) ([mhenrixon](https://github.com/mhenrixon))
|
127
|
+
|
128
|
+
## [v7.1.24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.24) (2022-06-09)
|
129
|
+
|
130
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.23...v7.1.24)
|
131
|
+
|
132
|
+
**Implemented enhancements:**
|
133
|
+
|
134
|
+
- Chore: Sidekiq 6.5 compatibility [\#715](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/715) ([mhenrixon](https://github.com/mhenrixon))
|
135
|
+
|
136
|
+
**Merged pull requests:**
|
137
|
+
|
138
|
+
- 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))
|
139
|
+
|
140
|
+
## [v7.1.23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.23) (2022-05-23)
|
141
|
+
|
142
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.22...v7.1.23)
|
143
|
+
|
144
|
+
**Fixed bugs:**
|
145
|
+
|
146
|
+
- fix: raise on error [\#712](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/712) ([mhenrixon](https://github.com/mhenrixon))
|
147
|
+
|
148
|
+
## [v7.1.22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.22) (2022-05-04)
|
149
|
+
|
150
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.21...v7.1.22)
|
151
|
+
|
152
|
+
**Fixed bugs:**
|
153
|
+
|
154
|
+
- Failed jobs waiting to be retried are not considered when fetching uniqueness [\#394](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/394)
|
155
|
+
- fix\(locksmith\): execute to yield without arguments [\#710](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/710) ([mhenrixon](https://github.com/mhenrixon))
|
156
|
+
- fix: re:lock until\_executing on worker failure [\#709](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/709) ([mhenrixon](https://github.com/mhenrixon))
|
157
|
+
|
158
|
+
**Closed issues:**
|
159
|
+
|
160
|
+
- Reviwing: Failed jobs waiting to be retried are not considered when fetching uniqueness [\#708](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/708)
|
161
|
+
|
162
|
+
## [v7.1.21](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.21) (2022-04-23)
|
163
|
+
|
164
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.20...v7.1.21)
|
165
|
+
|
166
|
+
**Implemented enhancements:**
|
167
|
+
|
168
|
+
- Prepare for Sidekiq v7 [\#707](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/707) ([mhenrixon](https://github.com/mhenrixon))
|
169
|
+
|
170
|
+
**Closed issues:**
|
171
|
+
|
172
|
+
- 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)
|
173
|
+
|
174
|
+
## [v7.1.20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.20) (2022-04-22)
|
175
|
+
|
176
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.19...v7.1.20)
|
177
|
+
|
178
|
+
**Implemented enhancements:**
|
179
|
+
|
180
|
+
- Manually handle timeouts [\#706](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/706) ([mhenrixon](https://github.com/mhenrixon))
|
181
|
+
|
182
|
+
**Merged pull requests:**
|
183
|
+
|
184
|
+
- improve README wrt. middleware config [\#704](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/704) ([slhck](https://github.com/slhck))
|
185
|
+
|
186
|
+
## [v7.1.19](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.19) (2022-04-09)
|
187
|
+
|
188
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.18...v7.1.19)
|
189
|
+
|
190
|
+
**Fixed bugs:**
|
191
|
+
|
192
|
+
- concurrent-ruby 1.1.10 spikes volume of jobs [\#701](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/701)
|
193
|
+
- Reimplement the entire TimerTask as it was [\#702](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/702) ([mhenrixon](https://github.com/mhenrixon))
|
194
|
+
|
195
|
+
## [v7.1.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.18) (2022-04-05)
|
196
|
+
|
197
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.17...v7.1.18)
|
198
|
+
|
199
|
+
**Implemented enhancements:**
|
200
|
+
|
201
|
+
- Make sure we reflect on execution failure [\#700](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/700) ([mhenrixon](https://github.com/mhenrixon))
|
202
|
+
|
203
|
+
## [v7.1.17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.17) (2022-04-05)
|
204
|
+
|
205
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.16...v7.1.17)
|
206
|
+
|
207
|
+
## [v7.1.16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.16) (2022-04-02)
|
208
|
+
|
209
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.15...v7.1.16)
|
210
|
+
|
211
|
+
**Implemented enhancements:**
|
212
|
+
|
213
|
+
- Abort Ruby Reaper when sidekiq queues are full [\#690](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/690) ([francesmcmullin](https://github.com/francesmcmullin))
|
214
|
+
- 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))
|
215
|
+
|
216
|
+
**Fixed bugs:**
|
217
|
+
|
218
|
+
- Hotfix: Ensure consistent lock args [\#699](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/699) ([mhenrixon](https://github.com/mhenrixon))
|
219
|
+
- Expire older changelog entries first [\#698](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/698) ([mhenrixon](https://github.com/mhenrixon))
|
220
|
+
- Fix drift [\#688](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/688) ([mhenrixon](https://github.com/mhenrixon))
|
221
|
+
|
222
|
+
**Closed issues:**
|
223
|
+
|
224
|
+
- concurrent-ruby has dropped support for TimerTask timeouts [\#697](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/697)
|
225
|
+
- Most recent changelogs are removed first [\#696](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/696)
|
226
|
+
- Improve README slightly [\#694](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/694)
|
227
|
+
- locksmith.rb:327: NoMethodError: undefined method `+' for nil:NilClass [\#686](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/686)
|
228
|
+
- lock\_timeout cannot be nil [\#675](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/675)
|
229
|
+
- Skip reaping when queues are too large [\#670](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/670)
|
230
|
+
|
231
|
+
**Merged pull requests:**
|
232
|
+
|
233
|
+
- Improve readme [\#695](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/695) ([fwolfst](https://github.com/fwolfst))
|
234
|
+
- Add funding\_uri to gemspec [\#693](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/693) ([fwolfst](https://github.com/fwolfst))
|
235
|
+
- Fix worker validator [\#685](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/685) ([victorfgs](https://github.com/victorfgs))
|
236
|
+
|
237
|
+
## [v7.1.15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.15) (2022-02-10)
|
238
|
+
|
239
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.14...v7.1.15)
|
240
|
+
|
241
|
+
**Merged pull requests:**
|
242
|
+
|
243
|
+
- Fixing reschedule when using a non default queue [\#679](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/679) ([bigzed](https://github.com/bigzed))
|
244
|
+
|
245
|
+
## [v7.1.14](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.14) (2022-02-04)
|
246
|
+
|
247
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.13...v7.1.14)
|
248
|
+
|
249
|
+
**Implemented enhancements:**
|
250
|
+
|
251
|
+
- Fix the remaining deprecation warnings [\#681](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/681) ([mhenrixon](https://github.com/mhenrixon))
|
252
|
+
|
253
|
+
## [v7.1.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.13) (2022-02-03)
|
254
|
+
|
255
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.12...v7.1.13)
|
256
|
+
|
257
|
+
**Implemented enhancements:**
|
258
|
+
|
259
|
+
- Prepare for redis 5.0.0 [\#680](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/680) ([mhenrixon](https://github.com/mhenrixon))
|
260
|
+
|
261
|
+
**Fixed bugs:**
|
262
|
+
|
263
|
+
- Fix homepage url [\#667](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/667) ([dal-ioki](https://github.com/dal-ioki))
|
264
|
+
|
265
|
+
**Closed issues:**
|
266
|
+
|
267
|
+
- Job finished, but lock is not cleared [\#677](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/677)
|
268
|
+
- sidekiq\_options lock conflicts with sidekiq-lock gem lock option [\#669](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/669)
|
269
|
+
- Slow evalsha causing timeouts [\#668](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/668)
|
270
|
+
- Inconsistent documentation for config validation [\#647](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/647)
|
271
|
+
|
272
|
+
**Merged pull requests:**
|
273
|
+
|
274
|
+
- Bump bundler and friends [\#674](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/674) ([mhenrixon](https://github.com/mhenrixon))
|
275
|
+
- readme: fix minitest assertion. [\#672](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/672) ([crondaemon](https://github.com/crondaemon))
|
276
|
+
- Pass `item` in `after_unlock` callback [\#665](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/665) ([piloos](https://github.com/piloos))
|
277
|
+
|
278
|
+
## [v7.1.12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.12) (2021-12-01)
|
279
|
+
|
280
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.11...v7.1.12)
|
281
|
+
|
282
|
+
**Implemented enhancements:**
|
283
|
+
|
284
|
+
- Improve Ruby Reaper performance under heavy load [\#663](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/663)
|
285
|
+
- Improve reaper performance under heavy load [\#666](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/666) ([mhenrixon](https://github.com/mhenrixon))
|
286
|
+
|
287
|
+
## [v7.1.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.11) (2021-11-30)
|
288
|
+
|
289
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.10...v7.1.11)
|
290
|
+
|
291
|
+
**Fixed bugs:**
|
292
|
+
|
293
|
+
- Fix ruby reaper edge case [\#661](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/661) ([mhenrixon](https://github.com/mhenrixon))
|
294
|
+
|
295
|
+
**Closed issues:**
|
296
|
+
|
297
|
+
- Question: Wait instead of cancelling if it is executing? [\#655](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/655)
|
298
|
+
- Expired Locks remain in zset of digests \[using "until\_expired" lock\] [\#653](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/653)
|
299
|
+
- \[Q&A\] Performance & Dead Locks [\#652](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/652)
|
300
|
+
- 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)
|
301
|
+
|
302
|
+
## [v7.1.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.10) (2021-10-18)
|
303
|
+
|
304
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.8...v7.1.10)
|
305
|
+
|
306
|
+
**Fixed bugs:**
|
307
|
+
|
308
|
+
- "IndexError: string not matched" when job is replaced on client [\#635](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/635)
|
309
|
+
|
310
|
+
**Merged pull requests:**
|
311
|
+
|
312
|
+
- Update URL for Sidekiq's Enterprise unique jobs [\#648](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/648) ([jsantos](https://github.com/jsantos))
|
313
|
+
|
314
|
+
## [v7.1.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.8) (2021-10-08)
|
315
|
+
|
316
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.13...v7.1.8)
|
317
|
+
|
318
|
+
**Fixed bugs:**
|
319
|
+
|
320
|
+
- undefined method `delete' for class `Sidekiq::Job' [\#634](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/634)
|
321
|
+
- INFO keys not persisted when job is enqueued [\#602](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/602)
|
322
|
+
- lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
|
323
|
+
- Prevent too eager cleanup of lock info [\#645](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/645) ([mhenrixon](https://github.com/mhenrixon))
|
324
|
+
|
325
|
+
**Closed issues:**
|
326
|
+
|
327
|
+
- Compatibility with unreleased Sidekiq 6.3.0 [\#636](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/636)
|
328
|
+
|
329
|
+
**Merged pull requests:**
|
330
|
+
|
331
|
+
- Update docs [\#644](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/644) ([andypple](https://github.com/andypple))
|
332
|
+
|
3
333
|
## [v7.0.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.13) (2021-09-27)
|
4
334
|
|
5
335
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.7...v7.0.13)
|
@@ -90,7 +420,7 @@
|
|
90
420
|
**Implemented enhancements:**
|
91
421
|
|
92
422
|
- 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) ([
|
423
|
+
- 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
424
|
|
95
425
|
**Fixed bugs:**
|
96
426
|
|
@@ -236,7 +566,6 @@
|
|
236
566
|
- Tasks run once, and then there is no launch [\#464](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/464)
|
237
567
|
- Jobs executing and immediately returning [\#418](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/418)
|
238
568
|
- 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
569
|
- Fix that :PRIMED keys are seemingly not removed [\#574](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/574) ([mhenrixon](https://github.com/mhenrixon))
|
241
570
|
|
242
571
|
**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
|
-
- [
|
34
|
+
- [reschedule](#reschedule)
|
35
35
|
- [Custom Strategies](#custom-strategies)
|
36
36
|
- [3 Cleanup Dead Locks](#3-cleanup-dead-locks)
|
37
37
|
- [Debugging](#debugging)
|
@@ -45,11 +45,11 @@ Want to show me some ❤️ for the hard work I do on this gem? You can use the
|
|
45
45
|
- [reschedule_failed](#reschedule_failed)
|
46
46
|
- [rescheduled](#rescheduled)
|
47
47
|
- [timeout](#timeout)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
- [unlock_failed](#unlock_failed)
|
49
|
+
- [unlocked](#unlocked)
|
50
|
+
- [unknown_sidekiq_worker](#unknown_sidekiq_worker)
|
51
|
+
- [Show Locks](#show-locks)
|
52
|
+
- [Show Lock](#show-lock)
|
53
53
|
- [Testing](#testing)
|
54
54
|
- [Validating Worker Configuration](#validating-worker-configuration)
|
55
55
|
- [Uniqueness](#uniqueness)
|
@@ -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
|
-
[
|
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
|
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
|
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
|
-
|
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
|
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
|
-
###
|
398
|
+
### reschedule
|
398
399
|
|
399
400
|
```ruby
|
400
401
|
sidekiq_options on_conflict: :reschedule
|
@@ -544,23 +545,23 @@ For when a job was successfully rescheduled
|
|
544
545
|
|
545
546
|
This is also mostly useful for reporting/metrics purposes. What this reflection does is signal that the job was configured to wait (`lock_timeout` was configured), but we couldn't retrieve a lock even though we waited for some time.
|
546
547
|
|
547
|
-
|
548
|
+
#### unlock_failed
|
548
549
|
|
549
|
-
This
|
550
|
+
This means that the server middleware could not unlock your job and the lock is kept (potentially preventing subsequent jobs from being pushed or processed).
|
550
551
|
|
551
|
-
|
552
|
+
#### unlocked
|
552
553
|
|
553
554
|
Also mostly useful for reporting purposes. The job was successfully unlocked.
|
554
555
|
|
555
|
-
|
556
|
+
#### unknown_sidekiq_worker
|
556
557
|
|
557
558
|
The reason this happens is that the server couldn't find a valid sidekiq worker class. Most likely, that worker isn't intended to be processed by this sidekiq server instance.
|
558
559
|
|
559
|
-
|
560
|
+
### Show Locks
|
560
561
|
|
561
562
|
![Locks](assets/unique_digests_1.png)
|
562
563
|
|
563
|
-
|
564
|
+
### Show Lock
|
564
565
|
|
565
566
|
![Lock](assets/unique_digests_2.png)
|
566
567
|
|
@@ -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
|
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
|
-
|
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://
|
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(
|
93
|
-
|
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,19 +100,15 @@ module SidekiqUniqueJobs
|
|
99
100
|
@count
|
100
101
|
end
|
101
102
|
|
102
|
-
def del_digest(
|
103
|
+
def del_digest(pipeline, digest)
|
103
104
|
removable_keys = keys_for_digest(digest)
|
104
105
|
|
105
|
-
|
106
|
-
conn.unlink(*removable_keys)
|
107
|
-
else
|
108
|
-
conn.del(*removable_keys)
|
109
|
-
end
|
106
|
+
pipeline.unlink(*removable_keys)
|
110
107
|
end
|
111
108
|
|
112
109
|
def keys_for_digest(digest)
|
113
110
|
[digest, "#{digest}:RUN"].each_with_object([]) do |key, digest_keys|
|
114
|
-
digest_keys.
|
111
|
+
digest_keys.push(key)
|
115
112
|
digest_keys.concat(SUFFIXES.map { |suffix| "#{key}:#{suffix}" })
|
116
113
|
end
|
117
114
|
end
|
@@ -7,13 +7,6 @@ module SidekiqUniqueJobs
|
|
7
7
|
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
8
8
|
#
|
9
9
|
class Changelog < Redis::SortedSet
|
10
|
-
#
|
11
|
-
# @return [Integer] the number of matches to return by default
|
12
|
-
DEFAULT_COUNT = 1_000
|
13
|
-
#
|
14
|
-
# @return [String] the default pattern to use for matching
|
15
|
-
SCAN_PATTERN = "*"
|
16
|
-
|
17
10
|
def initialize
|
18
11
|
super(CHANGELOGS)
|
19
12
|
end
|
@@ -42,12 +35,8 @@ module SidekiqUniqueJobs
|
|
42
35
|
# @return [Array<Hash>] an array of entries
|
43
36
|
#
|
44
37
|
def entries(pattern: SCAN_PATTERN, count: DEFAULT_COUNT)
|
45
|
-
options = {}
|
46
|
-
options[:match] = pattern
|
47
|
-
options[:count] = count
|
48
|
-
|
49
38
|
redis do |conn|
|
50
|
-
conn.
|
39
|
+
conn.zscan(key, match: pattern, count: count).to_a.map { |entry| load_json(entry[0]) }
|
51
40
|
end
|
52
41
|
end
|
53
42
|
|
@@ -62,15 +51,16 @@ module SidekiqUniqueJobs
|
|
62
51
|
#
|
63
52
|
def page(cursor: 0, pattern: "*", page_size: 100)
|
64
53
|
redis do |conn|
|
65
|
-
total_size, result = conn.multi do
|
66
|
-
|
67
|
-
|
54
|
+
total_size, result = conn.multi do |pipeline|
|
55
|
+
pipeline.zcard(key)
|
56
|
+
pipeline.zscan(key, cursor, match: pattern, count: page_size)
|
68
57
|
end
|
69
58
|
|
59
|
+
# NOTE: When debugging, check the last item in the returned array.
|
70
60
|
[
|
71
61
|
total_size.to_i,
|
72
|
-
result[0].to_i,
|
73
|
-
result[1].map { |entry| load_json(entry
|
62
|
+
result[0].to_i, # next_cursor
|
63
|
+
result[1].map { |entry| load_json(entry) }.select { |entry| entry.is_a?(Hash) },
|
74
64
|
]
|
75
65
|
end
|
76
66
|
end
|