sidekiq-unique-jobs 7.0.7 → 7.0.12
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 +90 -83
- data/README.md +11 -9
- data/lib/sidekiq_unique_jobs/lock/base_lock.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock_config.rb +5 -1
- data/lib/sidekiq_unique_jobs/locksmith.rb +17 -9
- data/lib/sidekiq_unique_jobs/logging.rb +31 -11
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +35 -1
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +1 -11
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 997eb6014dde8ab2896a7ccae9f1a6da4b298e1215fc7614366984b35a9b2786
|
4
|
+
data.tar.gz: '09904fed282a0cd42d3a92b22ee590a202eeb41ee111958bf17b703fc8664fbd'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '079842a1365a76ff6f17d1056848cc22774bb7007ae02e477609fff9544655f0b26e7d583963abcade5df1988b750a2efc7b16217b488d232664f8279f45c44c'
|
7
|
+
data.tar.gz: b287ea28677b4f5b0c52773038e3a4152fa531136e4f46c7bb4a81c888c3e3dd055cb9c4c8f5ba1872a152ac16fefdf2908bc7f10044b44f63cfdc6bbfeffb4e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,65 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.0.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.11) (2021-05-16)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.10...v7.0.11)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Constants are not necessary when deleting locks [\#606](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/606) ([mhenrixon](https://github.com/mhenrixon))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Sidekiq Pro Sharded Web UI Error \> 7.0.8 [\#605](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/605)
|
14
|
+
- Timed out after 0s while waiting for primed token [\#601](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/601)
|
15
|
+
|
16
|
+
## [v7.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.10) (2021-05-10)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.9...v7.0.10)
|
19
|
+
|
20
|
+
**Fixed bugs:**
|
21
|
+
|
22
|
+
- Add drift to original value [\#603](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/603) ([mhenrixon](https://github.com/mhenrixon))
|
23
|
+
|
24
|
+
**Closed issues:**
|
25
|
+
|
26
|
+
- Nested Sidekiq jobs are not kicked off with until\_and\_while\_executing [\#600](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/600)
|
27
|
+
|
28
|
+
## [v7.0.9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.9) (2021-04-26)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.8...v7.0.9)
|
31
|
+
|
32
|
+
**Fixed bugs:**
|
33
|
+
|
34
|
+
- lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
|
35
|
+
- Fix recording lock\_info [\#599](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/599) ([mhenrixon](https://github.com/mhenrixon))
|
36
|
+
|
37
|
+
## [v7.0.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.8) (2021-04-14)
|
38
|
+
|
39
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.7...v7.0.8)
|
40
|
+
|
41
|
+
**Implemented enhancements:**
|
42
|
+
|
43
|
+
- Lock performance [\#595](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/595) ([mhenrixon](https://github.com/mhenrixon))
|
44
|
+
- Allow and test ruby 3.0 [\#587](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/587) ([mhenrixon](https://github.com/mhenrixon))
|
45
|
+
|
46
|
+
**Closed issues:**
|
47
|
+
|
48
|
+
- Question: where do orphaned locks come from? [\#592](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/592)
|
49
|
+
- upgrade\_v6\_lock : ERR wrong number of arguments for 'hmset' command [\#591](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/591)
|
50
|
+
|
51
|
+
**Merged pull requests:**
|
52
|
+
|
53
|
+
- Fix uniqueness examples url in documentation [\#596](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/596) ([sampatbadhe](https://github.com/sampatbadhe))
|
54
|
+
|
55
|
+
## [v7.0.7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.7) (2021-03-19)
|
56
|
+
|
57
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.6...v7.0.7)
|
58
|
+
|
59
|
+
**Fixed bugs:**
|
60
|
+
|
61
|
+
- Web filter param not working in pagination [\#584](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/584) ([mhenrixon](https://github.com/mhenrixon))
|
62
|
+
|
3
63
|
## [v7.0.6](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.6) (2021-03-19)
|
4
64
|
|
5
65
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.5...v7.0.6)
|
@@ -55,10 +115,6 @@
|
|
55
115
|
|
56
116
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.1...v7.0.2)
|
57
117
|
|
58
|
-
**Implemented enhancements:**
|
59
|
-
|
60
|
-
- Give user full control over adding middleware [\#566](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/566) ([mhenrixon](https://github.com/mhenrixon))
|
61
|
-
|
62
118
|
**Fixed bugs:**
|
63
119
|
|
64
120
|
- Lock not getting properly cleared for some jobs [\#560](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/560)
|
@@ -95,7 +151,6 @@
|
|
95
151
|
|
96
152
|
- Any way to manually clear/reset the changelog history? [\#568](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/568)
|
97
153
|
- Present the entire changelog in its own view [\#569](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/569) ([mhenrixon](https://github.com/mhenrixon))
|
98
|
-
- Give user full control over adding middleware [\#566](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/566) ([mhenrixon](https://github.com/mhenrixon))
|
99
154
|
|
100
155
|
**Fixed bugs:**
|
101
156
|
|
@@ -112,6 +167,7 @@
|
|
112
167
|
|
113
168
|
**Implemented enhancements:**
|
114
169
|
|
170
|
+
- Give user full control over adding middleware [\#566](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/566) ([mhenrixon](https://github.com/mhenrixon))
|
115
171
|
- Fix coverage reporting and add coverage [\#565](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/565) ([mhenrixon](https://github.com/mhenrixon))
|
116
172
|
|
117
173
|
**Fixed bugs:**
|
@@ -144,7 +200,7 @@
|
|
144
200
|
**Fixed bugs:**
|
145
201
|
|
146
202
|
- lock\_args does not work when you define the lock\_args argument and default lock\_args function at the same time. [\#548](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/548)
|
147
|
-
- incorrect `:
|
203
|
+
- incorrect `:while_executing` behavior [\#432](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/432)
|
148
204
|
- Fix active check for the worker hash [\#558](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/558) ([mhenrixon](https://github.com/mhenrixon))
|
149
205
|
- Prefer lock\_prefix not unique\_prefix [\#554](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/554) ([mhenrixon](https://github.com/mhenrixon))
|
150
206
|
- Fix issue 432 [\#552](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/552) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -163,13 +219,9 @@
|
|
163
219
|
|
164
220
|
**Closed issues:**
|
165
221
|
|
166
|
-
- Documentation incorrect for `
|
222
|
+
- Documentation incorrect for `delete_by_digest` [\#547](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/547)
|
167
223
|
- Locked jobs after kill -9 with while\_executing lock [\#546](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/546)
|
168
224
|
|
169
|
-
**Merged pull requests:**
|
170
|
-
|
171
|
-
- Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
|
172
|
-
|
173
225
|
## [v7.0.0.beta26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta26) (2020-10-28)
|
174
226
|
|
175
227
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...v7.0.0.beta26)
|
@@ -187,11 +239,6 @@
|
|
187
239
|
|
188
240
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta25...v6.0.25)
|
189
241
|
|
190
|
-
**Implemented enhancements:**
|
191
|
-
|
192
|
-
- Support apartment [\#541](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/541) ([mhenrixon](https://github.com/mhenrixon))
|
193
|
-
- Support both instance method and class method [\#528](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/528) ([mhenrixon](https://github.com/mhenrixon))
|
194
|
-
|
195
242
|
## [v7.0.0.beta25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta25) (2020-10-26)
|
196
243
|
|
197
244
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
|
@@ -240,7 +287,6 @@
|
|
240
287
|
**Fixed bugs:**
|
241
288
|
|
242
289
|
- Ruby reaper incorrectly checks active jobs — removes every active lock as result [\#517](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/517)
|
243
|
-
- Backport \#465 to 6.x series [\#520](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/520) ([replaid](https://github.com/replaid))
|
244
290
|
|
245
291
|
## [v7.0.0.beta22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta22) (2020-06-12)
|
246
292
|
|
@@ -314,22 +360,17 @@
|
|
314
360
|
|
315
361
|
**Fixed bugs:**
|
316
362
|
|
317
|
-
- Deprecate configuration options with `
|
363
|
+
- Deprecate configuration options with `default_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
|
318
364
|
- Fix access to both server and client conflict [\#503](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/503) ([mhenrixon](https://github.com/mhenrixon))
|
319
|
-
- Use thread-safe digest creation mechanism [\#484](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/484) ([mhenrixon](https://github.com/mhenrixon))
|
320
365
|
|
321
366
|
**Closed issues:**
|
322
367
|
|
323
|
-
- V7 Beta 15 `
|
368
|
+
- V7 Beta 15 `on_conflict:` with Hash does not work on server [\#499](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/499)
|
324
369
|
|
325
370
|
## [v6.0.22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.22) (2020-04-13)
|
326
371
|
|
327
372
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta15...v6.0.22)
|
328
373
|
|
329
|
-
**Fixed bugs:**
|
330
|
-
|
331
|
-
- \[LockType\] Allow overwriting default lock type at item level [\#497](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/497) ([EmmN](https://github.com/EmmN))
|
332
|
-
|
333
374
|
## [v7.0.0.beta15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta15) (2020-04-10)
|
334
375
|
|
335
376
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta14...v7.0.0.beta15)
|
@@ -341,7 +382,7 @@
|
|
341
382
|
|
342
383
|
**Fixed bugs:**
|
343
384
|
|
344
|
-
- V7 - `
|
385
|
+
- V7 - `on_conflict:` no longer accepts a Hash [\#495](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/495)
|
345
386
|
- Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
|
346
387
|
- Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
|
347
388
|
- Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
|
@@ -378,10 +419,6 @@
|
|
378
419
|
- until\_expired is not setting TTL [\#468](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/468)
|
379
420
|
- Fix bug where expiration wasn't set until unlock [\#481](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/481) ([mhenrixon](https://github.com/mhenrixon))
|
380
421
|
|
381
|
-
**Merged pull requests:**
|
382
|
-
|
383
|
-
- Allow v7 configuration to work [\#479](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/479) ([mhenrixon](https://github.com/mhenrixon))
|
384
|
-
|
385
422
|
## [v6.0.20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.20) (2020-03-22)
|
386
423
|
|
387
424
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta11...v6.0.20)
|
@@ -395,10 +432,6 @@
|
|
395
432
|
- Please keep some recent versions on rubygems.org [\#478](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/478)
|
396
433
|
- validate\_worker! throws error [\#466](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/466)
|
397
434
|
|
398
|
-
**Merged pull requests:**
|
399
|
-
|
400
|
-
- Allow v7 configuration to work [\#479](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/479) ([mhenrixon](https://github.com/mhenrixon))
|
401
|
-
|
402
435
|
## [v7.0.0.beta11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta11) (2020-03-21)
|
403
436
|
|
404
437
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta10...v7.0.0.beta11)
|
@@ -432,12 +465,6 @@
|
|
432
465
|
|
433
466
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta9...v6.0.19)
|
434
467
|
|
435
|
-
**Fixed bugs:**
|
436
|
-
|
437
|
-
- Use thread-safe digest creation mechanism [\#484](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/484) ([mhenrixon](https://github.com/mhenrixon))
|
438
|
-
- Fix access to lock [\#476](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/476) ([mhenrixon](https://github.com/mhenrixon))
|
439
|
-
- Backport v7 fix for conflicts [\#461](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/461) ([mhenrixon](https://github.com/mhenrixon))
|
440
|
-
|
441
468
|
## [v7.0.0.beta9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta9) (2019-12-04)
|
442
469
|
|
443
470
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta8...v7.0.0.beta9)
|
@@ -449,7 +476,7 @@
|
|
449
476
|
|
450
477
|
**Closed issues:**
|
451
478
|
|
452
|
-
- until\_and\_while\_executing with sidekiq pro `
|
479
|
+
- until\_and\_while\_executing with sidekiq pro `reliable_scheduler!` [\#411](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/411)
|
453
480
|
|
454
481
|
## [v7.0.0.beta8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta8) (2019-11-28)
|
455
482
|
|
@@ -462,7 +489,7 @@
|
|
462
489
|
|
463
490
|
**Fixed bugs:**
|
464
491
|
|
465
|
-
- `
|
492
|
+
- `while_executing` has problems at low concurrency [\#384](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/384)
|
466
493
|
- lock: :until\_and\_while\_executing not working for scheduled jobs [\#334](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/334)
|
467
494
|
|
468
495
|
**Closed issues:**
|
@@ -499,7 +526,6 @@
|
|
499
526
|
**Fixed bugs:**
|
500
527
|
|
501
528
|
- Jobs not pushed when using sidekiq-status [\#412](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/412)
|
502
|
-
- Fix sidekiq options [\#458](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/458) ([mhenrixon](https://github.com/mhenrixon))
|
503
529
|
|
504
530
|
**Closed issues:**
|
505
531
|
|
@@ -529,18 +555,10 @@
|
|
529
555
|
|
530
556
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.16...v6.0.17)
|
531
557
|
|
532
|
-
**Fixed bugs:**
|
533
|
-
|
534
|
-
- Allow redis namespace to work with deletion [\#451](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/451) ([mhenrixon](https://github.com/mhenrixon))
|
535
|
-
|
536
558
|
## [v6.0.16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.16) (2019-11-25)
|
537
559
|
|
538
560
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta4...v6.0.16)
|
539
561
|
|
540
|
-
**Fixed bugs:**
|
541
|
-
|
542
|
-
- Ensure runtime locks are removed [\#447](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/447) ([mhenrixon](https://github.com/mhenrixon))
|
543
|
-
|
544
562
|
## [v7.0.0.beta4](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta4) (2019-11-25)
|
545
563
|
|
546
564
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta3...v7.0.0.beta4)
|
@@ -562,7 +580,6 @@
|
|
562
580
|
|
563
581
|
- Redis is busy running script and script never terminates [\#441](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/441)
|
564
582
|
- Make the ruby reaper plain ruby [\#443](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/443) ([mhenrixon](https://github.com/mhenrixon))
|
565
|
-
- Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
|
566
583
|
|
567
584
|
**Closed issues:**
|
568
585
|
|
@@ -582,7 +599,7 @@
|
|
582
599
|
|
583
600
|
**Closed issues:**
|
584
601
|
|
585
|
-
- incorrect `:
|
602
|
+
- incorrect `:until_and_while_executing` behavior [\#424](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/424)
|
586
603
|
|
587
604
|
## [v7.0.0.beta1](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta1) (2019-10-07)
|
588
605
|
|
@@ -601,9 +618,9 @@
|
|
601
618
|
**Fixed bugs:**
|
602
619
|
|
603
620
|
- Allow Sidekiq::Context to be used for logging [\#429](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/429) ([mhenrixon](https://github.com/mhenrixon))
|
621
|
+
- Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
|
604
622
|
- Reap as many orphans as advertised [\#403](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/403) ([mhenrixon](https://github.com/mhenrixon))
|
605
623
|
- Reaper should remove :INFO keys [\#399](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/399) ([mhenrixon](https://github.com/mhenrixon))
|
606
|
-
- Convert v5 locks when needed [\#375](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/375) ([mhenrixon](https://github.com/mhenrixon))
|
607
624
|
|
608
625
|
**Merged pull requests:**
|
609
626
|
|
@@ -620,14 +637,11 @@
|
|
620
637
|
**Implemented enhancements:**
|
621
638
|
|
622
639
|
- Lock both worker and queue [\#274](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/274)
|
623
|
-
- Copy working setup from master [\#420](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/420) ([mhenrixon](https://github.com/mhenrixon))
|
624
640
|
|
625
641
|
**Fixed bugs:**
|
626
642
|
|
627
643
|
- Duplicate job was pushed \( v6.0.13 \) [\#414](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/414)
|
628
644
|
- Constant SidekiqUniqueJobs::Web::Digests not found [\#396](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/396)
|
629
|
-
- Include redis directory [\#430](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/430) ([mhenrixon](https://github.com/mhenrixon))
|
630
|
-
- Fix v6 [\#428](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/428) ([mhenrixon](https://github.com/mhenrixon))
|
631
645
|
|
632
646
|
**Closed issues:**
|
633
647
|
|
@@ -653,7 +667,7 @@
|
|
653
667
|
|
654
668
|
**Closed issues:**
|
655
669
|
|
656
|
-
- Unique args in combination with sidekiq cron contains
|
670
|
+
- Unique args in combination with sidekiq cron contains `_aj_symbol_keys` [\#363](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/363)
|
657
671
|
- Low quality piece of shit [\#360](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/360)
|
658
672
|
- Passthrough has been deprecated and will be removed in redis-namespace 2.0 [\#338](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/338)
|
659
673
|
|
@@ -766,10 +780,6 @@
|
|
766
780
|
|
767
781
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.6...v5.0.11)
|
768
782
|
|
769
|
-
**Fixed bugs:**
|
770
|
-
|
771
|
-
- Always Remove Job ID from uniquejobs Hash [\#347](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/347) ([chadrschroeder](https://github.com/chadrschroeder))
|
772
|
-
|
773
783
|
**Closed issues:**
|
774
784
|
|
775
785
|
- concurrent-ruby 1.1.1 is causing this gem to break [\#340](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/340)
|
@@ -889,7 +899,6 @@
|
|
889
899
|
- Sidekiq web [\#297](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/297) ([mhenrixon](https://github.com/mhenrixon))
|
890
900
|
- Document code [\#296](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/296) ([mhenrixon](https://github.com/mhenrixon))
|
891
901
|
- Rename to `unique:` to `lock:` [\#295](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/295) ([mhenrixon](https://github.com/mhenrixon))
|
892
|
-
- Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
|
893
902
|
|
894
903
|
**Closed issues:**
|
895
904
|
|
@@ -933,6 +942,7 @@
|
|
933
942
|
**Implemented enhancements:**
|
934
943
|
|
935
944
|
- Prepare for v6 [\#286](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/286) ([mhenrixon](https://github.com/mhenrixon))
|
945
|
+
- Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
|
936
946
|
|
937
947
|
## [v6.0.0.rc3](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc3) (2018-06-29)
|
938
948
|
|
@@ -999,13 +1009,6 @@
|
|
999
1009
|
- Code smells [\#275](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/275) ([mhenrixon](https://github.com/mhenrixon))
|
1000
1010
|
- Reject while scheduling [\#273](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/273) ([mhenrixon](https://github.com/mhenrixon))
|
1001
1011
|
- Improve testing [\#272](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/272) ([mhenrixon](https://github.com/mhenrixon))
|
1002
|
-
|
1003
|
-
## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
|
1004
|
-
|
1005
|
-
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
|
1006
|
-
|
1007
|
-
**Implemented enhancements:**
|
1008
|
-
|
1009
1012
|
- Until and while executing [\#271](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/271) ([mhenrixon](https://github.com/mhenrixon))
|
1010
1013
|
- Solidify master [\#270](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/270) ([mhenrixon](https://github.com/mhenrixon))
|
1011
1014
|
- Minor adjustments [\#268](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/268) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -1016,24 +1019,29 @@
|
|
1016
1019
|
|
1017
1020
|
- Allow `jobs keys` to default to listing all keys [\#252](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/252) ([soundasleep](https://github.com/soundasleep))
|
1018
1021
|
|
1022
|
+
**Merged pull requests:**
|
1023
|
+
|
1024
|
+
- Improve documentation [\#269](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/269) ([mhenrixon](https://github.com/mhenrixon))
|
1025
|
+
- Remove unnecessary monkey patches for String [\#262](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/262) ([zormandi](https://github.com/zormandi))
|
1026
|
+
- README \> While Executing: remove unnecessary word [\#260](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/260) ([TimCannady](https://github.com/TimCannady))
|
1027
|
+
- Don't skip monkeypatches if ActiveSupport present [\#248](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/248) ([dleavitt](https://github.com/dleavitt))
|
1028
|
+
- Better runtime locks [\#241](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/241) ([mhenrixon](https://github.com/mhenrixon))
|
1029
|
+
|
1030
|
+
## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
|
1031
|
+
|
1032
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
|
1033
|
+
|
1019
1034
|
**Closed issues:**
|
1020
1035
|
|
1021
1036
|
- Incomplete sentence in README [\#264](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/264)
|
1022
1037
|
- ActiveJob and Sidekiq::Worker [\#259](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/259)
|
1023
1038
|
- ActiveJob and Sidekiq::Worker [\#258](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/258)
|
1024
|
-
- Non-unique jobs can be added even when `
|
1039
|
+
- Non-unique jobs can be added even when `sidekiq_options unique: :until_executed` [\#251](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/251)
|
1025
1040
|
- Trouble with "inline" mode [\#243](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/243)
|
1026
1041
|
- Sidekiq::Worker.set not working with sidekiq-unique-jobs [\#242](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/242)
|
1027
1042
|
- sidekiq-unique-job with ActiveJob [\#238](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/238)
|
1028
1043
|
- Deadlock using :while\_executing? [\#233](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/233)
|
1029
1044
|
|
1030
|
-
**Merged pull requests:**
|
1031
|
-
|
1032
|
-
- Improve documentation [\#269](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/269) ([mhenrixon](https://github.com/mhenrixon))
|
1033
|
-
- Remove unnecessary monkey patches for String [\#262](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/262) ([zormandi](https://github.com/zormandi))
|
1034
|
-
- README \> While Executing: remove unnecessary word [\#260](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/260) ([TimCannady](https://github.com/TimCannady))
|
1035
|
-
- Don't skip monkeypatches if ActiveSupport present [\#248](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/248) ([dleavitt](https://github.com/dleavitt))
|
1036
|
-
|
1037
1045
|
## [v5.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10) (2017-08-19)
|
1038
1046
|
|
1039
1047
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.9...v5.0.10)
|
@@ -1060,7 +1068,6 @@
|
|
1060
1068
|
|
1061
1069
|
**Merged pull requests:**
|
1062
1070
|
|
1063
|
-
- Better runtime locks [\#241](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/241) ([mhenrixon](https://github.com/mhenrixon))
|
1064
1071
|
- Your testing lib is broken and don't permit to test uniqueness of jobs [\#232](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/232) ([keysen](https://github.com/keysen))
|
1065
1072
|
- Use hscan for Util\#expire [\#229](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/229) ([dmkc](https://github.com/dmkc))
|
1066
1073
|
- Fixed documentation example about unique\_args [\#228](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/228) ([andresakata](https://github.com/andresakata))
|
@@ -1245,7 +1252,7 @@
|
|
1245
1252
|
|
1246
1253
|
- Can't schedule a job from another job [\#151](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/151)
|
1247
1254
|
- perform\_in not working in version 4.0.9 [\#150](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/150)
|
1248
|
-
- `unique:
|
1255
|
+
- `unique: until_and_while_executing` not working as expected [\#146](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/146)
|
1249
1256
|
- while\_executing still runs duplicate tasks [\#136](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/136)
|
1250
1257
|
- Version 4 Upgrade [\#133](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/133)
|
1251
1258
|
|
@@ -1386,7 +1393,7 @@
|
|
1386
1393
|
- Testing [\#103](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/103)
|
1387
1394
|
- Active Job [\#102](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/102)
|
1388
1395
|
- Why is SidekiqUnique behaviour applied to regular Workers? [\#100](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/100)
|
1389
|
-
- Confusing behavior when trying to
|
1396
|
+
- Confusing behavior when trying to `[1,2,3].each { |n| SomeJob.perform_in(n.seconds.from_now, n) }` never running, logging as duplicate value [\#98](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/98)
|
1390
1397
|
- Scheduled jobs are not unlocked when deleted [\#97](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/97)
|
1391
1398
|
- Testing functions should be moved out of production code [\#95](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/95)
|
1392
1399
|
- Jobs can unlock mutexes they don't own [\#94](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/94)
|
@@ -1420,6 +1427,7 @@
|
|
1420
1427
|
- Do not unlock on sidekiq shutdown [\#87](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/87) ([deltaroe](https://github.com/deltaroe))
|
1421
1428
|
- Remove no-op code, protect global space from test code [\#86](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/86) ([stevenjonescgm](https://github.com/stevenjonescgm))
|
1422
1429
|
- Remove unique lock when executing and clearing jobs in sidekiq fake mode [\#83](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/83) ([crberube](https://github.com/crberube))
|
1430
|
+
- Fix tests. Tests with latest sidekiq versions and ruby versions [\#82](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/82) ([simonoff](https://github.com/simonoff))
|
1423
1431
|
- Duplicate Payload logging configuration [\#81](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/81) ([jprincipe](https://github.com/jprincipe))
|
1424
1432
|
- output log if not unique [\#79](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/79) ([sonots](https://github.com/sonots))
|
1425
1433
|
- Checking Sidekiq::Testing.inline? on testing strategy and connector [\#75](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/75) ([Draiken](https://github.com/Draiken))
|
@@ -1435,7 +1443,6 @@
|
|
1435
1443
|
|
1436
1444
|
**Merged pull requests:**
|
1437
1445
|
|
1438
|
-
- Fix tests. Tests with latest sidekiq versions and ruby versions [\#82](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/82) ([simonoff](https://github.com/simonoff))
|
1439
1446
|
- Use ConnectionPool blocks to ensure exclusive connection. Closes \#66. [\#67](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/67) ([adstage-david](https://github.com/adstage-david))
|
1440
1447
|
|
1441
1448
|
## [v3.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v3.0.10) (2014-11-19)
|
@@ -1517,7 +1524,6 @@
|
|
1517
1524
|
- Clarify README about unique expiration [\#36](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/36) ([spacemunkay](https://github.com/spacemunkay))
|
1518
1525
|
- Add option to make jobs unique on all queues [\#32](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/32) ([robinmessage](https://github.com/robinmessage))
|
1519
1526
|
- Fix homepage in gemspec [\#29](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/29) ([tmaier](https://github.com/tmaier))
|
1520
|
-
- Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
|
1521
1527
|
|
1522
1528
|
## [v2.7.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v2.7.0) (2013-11-24)
|
1523
1529
|
|
@@ -1535,7 +1541,8 @@
|
|
1535
1541
|
|
1536
1542
|
- Make unlock/yield order configurable. [\#21](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/21) ([endofunky](https://github.com/endofunky))
|
1537
1543
|
- Rely on Sidekiq's String\#constantize extension instead of rolling our own [\#19](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/19) ([disbelief](https://github.com/disbelief))
|
1538
|
-
- Attempt to constantize String `
|
1544
|
+
- Attempt to constantize String `worker_class` arguments passed to client middleware [\#17](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/17) ([disbelief](https://github.com/disbelief))
|
1545
|
+
- Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
|
1539
1546
|
- Allow worker to specify which arguments to include in uniquing hash [\#12](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/12) ([sax](https://github.com/sax))
|
1540
1547
|
- Add support for unique when using Sidekiq's delay function [\#11](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/11) ([eduardosasso](https://github.com/eduardosasso))
|
1541
1548
|
- Adding the unique prefix option [\#8](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/8) ([KensoDev](https://github.com/KensoDev))
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
# SidekiqUniqueJobs
|
1
|
+
# SidekiqUniqueJobs
|
2
|
+
|
3
|
+
[![Join the chat at https://gitter.im/mhenrixon/sidekiq-unique-jobs](https://badges.gitter.im/mhenrixon/sidekiq-unique-jobs.svg)](https://gitter.im/mhenrixon/sidekiq-unique-jobs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Build Status](https://github.com/mhenrixon/sidekiq-unique-jobs/actions/workflows/rspec.yml/badge.svg?branch=master) [![Code Climate](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs) [![Test Coverage](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/badges/coverage.svg)](https://codeclimate.com/github/mhenrixon/sidekiq-unique-jobs/coverage)
|
2
4
|
|
3
5
|
<!-- MarkdownTOC -->
|
4
6
|
|
@@ -224,7 +226,7 @@ SidekiqUniqueJobs.config.lock_ttl #=> nil
|
|
224
226
|
|
225
227
|
Set a global lock_ttl to use for all jobs that don't otherwise specify a lock_ttl.
|
226
228
|
|
227
|
-
Lock TTL decides how long to wait
|
229
|
+
Lock TTL decides how long to wait at most before considering a lock to be expired and making it possible to reuse that lock.
|
228
230
|
|
229
231
|
### enabled
|
230
232
|
|
@@ -334,7 +336,7 @@ sidekiq_options lock_prefix: "uniquejobs" # this is the default value
|
|
334
336
|
|
335
337
|
### lock_ttl
|
336
338
|
|
337
|
-
Lock TTL decides how long to wait
|
339
|
+
Lock TTL decides how long to wait at most before considering a lock to be expired and making it possible to reuse that lock.
|
338
340
|
|
339
341
|
Starting from `v7` the expiration will take place when the job is pushed to the queue.
|
340
342
|
|
@@ -565,7 +567,7 @@ You may need to define some custom strategy. You can define it in one project fo
|
|
565
567
|
```ruby
|
566
568
|
# lib/strategies/my_custom_strategy.rb
|
567
569
|
module Strategies
|
568
|
-
class MyCustomStrategy < OnConflict::Strategy
|
570
|
+
class MyCustomStrategy < SidekiqUniqueJobs::OnConflict::Strategy
|
569
571
|
def call
|
570
572
|
# Do something ...
|
571
573
|
end
|
@@ -905,11 +907,11 @@ end
|
|
905
907
|
|
906
908
|
It is recommended to leave the uniqueness testing to the gem maintainers. If you care about how the gem is integration tested have a look at the following specs:
|
907
909
|
|
908
|
-
- [spec/
|
909
|
-
- [spec/
|
910
|
-
- [spec/
|
911
|
-
- [spec/
|
912
|
-
- [spec/
|
910
|
+
- [spec/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb)
|
911
|
+
- [spec/sidekiq_unique_jobs/lock/until_executed_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/sidekiq_unique_jobs/lock/until_executed_spec.rb)
|
912
|
+
- [spec/sidekiq_unique_jobs/lock/until_expired_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/sidekiq_unique_jobs/lock/until_expired_spec.rb)
|
913
|
+
- [spec/sidekiq_unique_jobs/lock/while_executing_reject_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/sidekiq_unique_jobs/lock/while_executing_reject_spec.rb)
|
914
|
+
- [spec/sidekiq_unique_jobs/lock/while_executing_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/sidekiq_unique_jobs/lock/while_executing_spec.rb)
|
913
915
|
|
914
916
|
## Contributing
|
915
917
|
|
@@ -124,7 +124,7 @@ module SidekiqUniqueJobs
|
|
124
124
|
attr_reader :attempt
|
125
125
|
|
126
126
|
def unlock_with_callback
|
127
|
-
return log_warn("
|
127
|
+
return log_warn("Might need to be unlocked manually", item) unless unlock
|
128
128
|
|
129
129
|
callback_safely
|
130
130
|
item[JID]
|
@@ -134,7 +134,7 @@ module SidekiqUniqueJobs
|
|
134
134
|
callback&.call
|
135
135
|
item[JID]
|
136
136
|
rescue StandardError
|
137
|
-
log_warn("
|
137
|
+
log_warn("Unlocked successfully but the #after_unlock callback failed!", item)
|
138
138
|
raise
|
139
139
|
end
|
140
140
|
|
@@ -21,7 +21,7 @@ module SidekiqUniqueJobs
|
|
21
21
|
runtime_lock.execute { return yield }
|
22
22
|
end
|
23
23
|
else
|
24
|
-
log_warn
|
24
|
+
log_warn("Couldn't unlock digest: #{item[LOCK_DIGEST]}, jid: #{item[JID]}")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,7 +30,7 @@ module SidekiqUniqueJobs
|
|
30
30
|
def lock_on_failure
|
31
31
|
yield
|
32
32
|
rescue Exception # rubocop:disable Lint/RescueException
|
33
|
-
log_error("Runtime lock failed to execute job, restoring server lock")
|
33
|
+
log_error("Runtime lock failed to execute job, restoring server lock", item)
|
34
34
|
lock
|
35
35
|
raise
|
36
36
|
end
|
@@ -58,7 +58,7 @@ module SidekiqUniqueJobs
|
|
58
58
|
|
59
59
|
def initialize(job_hash = {})
|
60
60
|
@type = job_hash[LOCK]&.to_sym
|
61
|
-
@worker = job_hash[CLASS]
|
61
|
+
@worker = SidekiqUniqueJobs.safe_constantize(job_hash[CLASS])
|
62
62
|
@limit = job_hash.fetch(LOCK_LIMIT, 1)
|
63
63
|
@timeout = job_hash.fetch(LOCK_TIMEOUT, 0)
|
64
64
|
@ttl = job_hash.fetch(LOCK_TTL) { job_hash.fetch(LOCK_EXPIRATION, nil) }.to_i
|
@@ -71,6 +71,10 @@ module SidekiqUniqueJobs
|
|
71
71
|
@on_server_conflict = job_hash[ON_SERVER_CONFLICT]
|
72
72
|
end
|
73
73
|
|
74
|
+
def lock_info?
|
75
|
+
lock_info
|
76
|
+
end
|
77
|
+
|
74
78
|
#
|
75
79
|
# Indicate if timeout was set
|
76
80
|
#
|
@@ -199,7 +199,7 @@ module SidekiqUniqueJobs
|
|
199
199
|
def primed_async(conn)
|
200
200
|
return yield if Concurrent::Promises
|
201
201
|
.future(conn) { |red_con| pop_queued(red_con) }
|
202
|
-
.value(
|
202
|
+
.value(add_drift(config.ttl))
|
203
203
|
|
204
204
|
warn_about_timeout
|
205
205
|
end
|
@@ -220,7 +220,7 @@ module SidekiqUniqueJobs
|
|
220
220
|
enqueue(conn) do
|
221
221
|
primed_sync(conn) do
|
222
222
|
locked_token = call_script(:lock, key.to_a, argv, conn)
|
223
|
-
return yield if locked_token
|
223
|
+
return yield locked_token if locked_token
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -235,7 +235,9 @@ module SidekiqUniqueJobs
|
|
235
235
|
# @return [Object] whatever the block returns when lock was acquired
|
236
236
|
#
|
237
237
|
def primed_sync(conn)
|
238
|
-
|
238
|
+
if (popped_jid = pop_queued(conn))
|
239
|
+
return yield popped_jid
|
240
|
+
end
|
239
241
|
|
240
242
|
warn_about_timeout
|
241
243
|
end
|
@@ -260,7 +262,7 @@ module SidekiqUniqueJobs
|
|
260
262
|
#
|
261
263
|
def brpoplpush(conn)
|
262
264
|
# passing timeout 0 to brpoplpush causes it to block indefinitely
|
263
|
-
conn.brpoplpush(key.queued, key.primed, timeout: config.timeout
|
265
|
+
conn.brpoplpush(key.queued, key.primed, timeout: config.timeout)
|
264
266
|
end
|
265
267
|
|
266
268
|
#
|
@@ -288,7 +290,7 @@ module SidekiqUniqueJobs
|
|
288
290
|
return unless queued_token && (validity >= 0 || config.pttl.zero?)
|
289
291
|
|
290
292
|
write_lock_info(conn)
|
291
|
-
yield
|
293
|
+
yield queued_token
|
292
294
|
end
|
293
295
|
|
294
296
|
#
|
@@ -299,7 +301,7 @@ module SidekiqUniqueJobs
|
|
299
301
|
# @return [void]
|
300
302
|
#
|
301
303
|
def write_lock_info(conn)
|
302
|
-
return unless config.lock_info
|
304
|
+
return unless config.lock_info?
|
303
305
|
|
304
306
|
conn.set(key.info, lock_info)
|
305
307
|
end
|
@@ -315,7 +317,11 @@ module SidekiqUniqueJobs
|
|
315
317
|
# Add 2 milliseconds to the drift to account for Redis expires
|
316
318
|
# precision, which is 1 millisecond, plus 1 millisecond min drift
|
317
319
|
# for small TTLs.
|
318
|
-
(val
|
320
|
+
(val + 2).to_f * CLOCK_DRIFT_FACTOR
|
321
|
+
end
|
322
|
+
|
323
|
+
def add_drift(val)
|
324
|
+
val + drift(val)
|
319
325
|
end
|
320
326
|
|
321
327
|
#
|
@@ -330,7 +336,9 @@ module SidekiqUniqueJobs
|
|
330
336
|
end
|
331
337
|
|
332
338
|
def warn_about_timeout
|
333
|
-
|
339
|
+
return unless config.wait_for_lock?
|
340
|
+
|
341
|
+
log_debug("Timed out after #{config.timeout}s while waiting for primed token (digest: #{key}, job_id: #{job_id})")
|
334
342
|
end
|
335
343
|
|
336
344
|
def lock_info
|
@@ -340,7 +348,7 @@ module SidekiqUniqueJobs
|
|
340
348
|
LIMIT => item[LOCK_LIMIT],
|
341
349
|
TIMEOUT => item[LOCK_TIMEOUT],
|
342
350
|
TTL => item[LOCK_TTL],
|
343
|
-
|
351
|
+
TYPE => config.type,
|
344
352
|
LOCK_ARGS => item[LOCK_ARGS],
|
345
353
|
TIME => now_f,
|
346
354
|
)
|
@@ -29,8 +29,9 @@ module SidekiqUniqueJobs
|
|
29
29
|
#
|
30
30
|
# @yield [String, Exception] the message or exception to use for log message
|
31
31
|
#
|
32
|
-
def log_debug(message_or_exception = nil, &block)
|
33
|
-
|
32
|
+
def log_debug(message_or_exception = nil, item = nil, &block)
|
33
|
+
message = build_message(message_or_exception, item)
|
34
|
+
logger.debug(message, &block)
|
34
35
|
nil
|
35
36
|
end
|
36
37
|
|
@@ -43,8 +44,9 @@ module SidekiqUniqueJobs
|
|
43
44
|
#
|
44
45
|
# @yield [String, Exception] the message or exception to use for log message
|
45
46
|
#
|
46
|
-
def log_info(message_or_exception = nil, &block)
|
47
|
-
|
47
|
+
def log_info(message_or_exception = nil, item = nil, &block)
|
48
|
+
message = build_message(message_or_exception, item)
|
49
|
+
logger.info(message, &block)
|
48
50
|
nil
|
49
51
|
end
|
50
52
|
|
@@ -57,8 +59,9 @@ module SidekiqUniqueJobs
|
|
57
59
|
#
|
58
60
|
# @yield [String, Exception] the message or exception to use for log message
|
59
61
|
#
|
60
|
-
def log_warn(message_or_exception = nil, &block)
|
61
|
-
|
62
|
+
def log_warn(message_or_exception = nil, item = nil, &block)
|
63
|
+
message = build_message(message_or_exception, item)
|
64
|
+
logger.warn(message, &block)
|
62
65
|
nil
|
63
66
|
end
|
64
67
|
|
@@ -71,8 +74,9 @@ module SidekiqUniqueJobs
|
|
71
74
|
#
|
72
75
|
# @yield [String, Exception] the message or exception to use for log message
|
73
76
|
#
|
74
|
-
def log_error(message_or_exception = nil, &block)
|
75
|
-
|
77
|
+
def log_error(message_or_exception = nil, item = nil, &block)
|
78
|
+
message = build_message(message_or_exception, item)
|
79
|
+
logger.error(message, &block)
|
76
80
|
nil
|
77
81
|
end
|
78
82
|
|
@@ -85,11 +89,27 @@ module SidekiqUniqueJobs
|
|
85
89
|
#
|
86
90
|
# @yield [String, Exception] the message or exception to use for log message
|
87
91
|
#
|
88
|
-
def log_fatal(message_or_exception = nil, &block)
|
89
|
-
|
92
|
+
def log_fatal(message_or_exception = nil, item = nil, &block)
|
93
|
+
message = build_message(message_or_exception, item)
|
94
|
+
logger.fatal(message, &block)
|
90
95
|
nil
|
91
96
|
end
|
92
97
|
|
98
|
+
def build_message(message_or_exception, item = nil)
|
99
|
+
return nil if message_or_exception.nil?
|
100
|
+
return message_or_exception if item.nil?
|
101
|
+
|
102
|
+
message = message_or_exception.dup
|
103
|
+
details = item.slice(LOCK, QUEUE, CLASS, JID, LOCK_DIGEST).each_with_object([]) do |(key, value), memo|
|
104
|
+
memo << "#{key}=#{value}"
|
105
|
+
end
|
106
|
+
message << " ("
|
107
|
+
message << details.join(" ")
|
108
|
+
message << ")"
|
109
|
+
|
110
|
+
message
|
111
|
+
end
|
112
|
+
|
93
113
|
#
|
94
114
|
# Wraps the middleware logic with context aware logging
|
95
115
|
#
|
@@ -172,7 +192,7 @@ module SidekiqUniqueJobs
|
|
172
192
|
end
|
173
193
|
|
174
194
|
def sidekiq_logger_context_method
|
175
|
-
logger.method(:with_context)
|
195
|
+
logger.method(:with_context) if logger_respond_to_with_context?
|
176
196
|
end
|
177
197
|
|
178
198
|
def sidekiq_logging_context_method
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Contains configuration and utility methods that belongs top level
|
5
5
|
#
|
6
6
|
# @author Mikael Henriksson <mikael@mhenrixon.com>
|
7
|
-
module SidekiqUniqueJobs
|
7
|
+
module SidekiqUniqueJobs # rubocop:disable Metrics/ModuleLength
|
8
8
|
include SidekiqUniqueJobs::Connection
|
9
9
|
extend SidekiqUniqueJobs::JSON
|
10
10
|
|
@@ -236,4 +236,38 @@ module SidekiqUniqueJobs
|
|
236
236
|
lock_config = validate_worker(options)
|
237
237
|
raise InvalidWorker, lock_config unless lock_config.errors.empty?
|
238
238
|
end
|
239
|
+
|
240
|
+
# Attempt to constantize a string worker_class argument, always
|
241
|
+
# failing back to the original argument when the constant can't be found
|
242
|
+
#
|
243
|
+
# @return [Sidekiq::Worker]
|
244
|
+
def constantize(str)
|
245
|
+
return str.class if str.is_a?(Sidekiq::Worker) # sidekiq v6.x
|
246
|
+
return str unless str.is_a?(String)
|
247
|
+
return Object.const_get(str) unless str.include?("::")
|
248
|
+
|
249
|
+
names = str.split("::")
|
250
|
+
names.shift if names.empty? || names.first.empty?
|
251
|
+
|
252
|
+
names.inject(Object) do |constant, name|
|
253
|
+
# the false flag limits search for name to under the constant namespace
|
254
|
+
# which mimics Rails' behaviour
|
255
|
+
constant.const_get(name, false)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Attempt to constantize a string worker_class argument, always
|
260
|
+
# failing back to the original argument when the constant can't be found
|
261
|
+
#
|
262
|
+
# @return [Sidekiq::Worker, String]
|
263
|
+
def safe_constantize(str)
|
264
|
+
constantize(str)
|
265
|
+
rescue NameError => ex
|
266
|
+
case ex.message
|
267
|
+
when /uninitialized constant/
|
268
|
+
str
|
269
|
+
else
|
270
|
+
raise
|
271
|
+
end
|
272
|
+
end
|
239
273
|
end
|
@@ -49,17 +49,7 @@ module SidekiqUniqueJobs
|
|
49
49
|
#
|
50
50
|
# @return [Sidekiq::Worker]
|
51
51
|
def worker_class_constantize(klazz = @worker_class)
|
52
|
-
|
53
|
-
return klazz unless klazz.is_a?(String)
|
54
|
-
|
55
|
-
Object.const_get(klazz)
|
56
|
-
rescue NameError => ex
|
57
|
-
case ex.message
|
58
|
-
when /uninitialized constant/
|
59
|
-
klazz
|
60
|
-
else
|
61
|
-
raise
|
62
|
-
end
|
52
|
+
SidekiqUniqueJobs.safe_constantize(klazz)
|
63
53
|
end
|
64
54
|
|
65
55
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-unique-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpoplpush-redis_script
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
|
-
rubygems_version: 3.2.
|
260
|
+
rubygems_version: 3.2.19
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: Sidekiq middleware that prevents duplicates jobs
|