sidekiq-unique-jobs 7.0.6 → 7.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15ac11b6577e3aec68065e79d9d5b61d67b88e958c23097b04409869e4a6c18f
4
- data.tar.gz: d6d8f8244abf8b4dacfc28a313b94d89edee88002052618f018ea81fc29cb32a
3
+ metadata.gz: d8bf67dee2b01934cc8d2402a9662d7b1048ec75c2ca7ac76c5ec00ac1e07ffe
4
+ data.tar.gz: bca38efcab9618fc146707ad4530a53cbe2983ae07a31fe923a9f9c8afc1415a
5
5
  SHA512:
6
- metadata.gz: dfc16d255733a016d93b1a5699f740732c4e2095ecbe20e9562512c4a2ab0dd51c221a681b7ee9e6ccdb9ce9b90a1dcd2a8902d26089658b3936f2e0667ca1b3
7
- data.tar.gz: dd52aa2aa2ec53260e8ba8569827bc825e926e3245585731e17130693ef588c8482ad0539f74fa6ce43436d6476b38cf8e0303990b6689783b2ce6277f05f1c4
6
+ metadata.gz: e2edc9978a36bb106b610d708489b620b79443075a2c7e240154674d59574c5e0a5654cf9883ea6d9dc35aca6ba41ccf8ac3c1a566dbbcb767eb375b1dc41b85
7
+ data.tar.gz: de60d4517653af2d64d23f2fcc17f8a757e0239d86f379a6b6f87db12aaaf299b144a75895468859118a28230a5f1f1f880182cf6a89981fdcae08b9f3d17b84
data/CHANGELOG.md CHANGED
@@ -2,11 +2,71 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.5...HEAD)
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.10...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Timed out after 0s while waiting for primed token [\#601](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/601)
10
+
11
+ ## [v7.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.10) (2021-05-10)
12
+
13
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.9...v7.0.10)
14
+
15
+ **Fixed bugs:**
16
+
17
+ - Add drift to original value [\#603](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/603) ([mhenrixon](https://github.com/mhenrixon))
18
+
19
+ **Closed issues:**
20
+
21
+ - Nested Sidekiq jobs are not kicked off with until\_and\_while\_executing [\#600](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/600)
22
+
23
+ ## [v7.0.9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.9) (2021-04-26)
24
+
25
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.8...v7.0.9)
26
+
27
+ **Fixed bugs:**
28
+
29
+ - lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
30
+ - Fix recording lock\_info [\#599](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/599) ([mhenrixon](https://github.com/mhenrixon))
31
+
32
+ ## [v7.0.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.8) (2021-04-14)
33
+
34
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.7...v7.0.8)
35
+
36
+ **Implemented enhancements:**
37
+
38
+ - Lock performance [\#595](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/595) ([mhenrixon](https://github.com/mhenrixon))
39
+ - Allow and test ruby 3.0 [\#587](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/587) ([mhenrixon](https://github.com/mhenrixon))
40
+
41
+ **Closed issues:**
42
+
43
+ - Question: where do orphaned locks come from? [\#592](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/592)
44
+ - upgrade\_v6\_lock : ERR wrong number of arguments for 'hmset' command [\#591](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/591)
45
+
46
+ **Merged pull requests:**
47
+
48
+ - Fix uniqueness examples url in documentation [\#596](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/596) ([sampatbadhe](https://github.com/sampatbadhe))
49
+
50
+ ## [v7.0.7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.7) (2021-03-19)
51
+
52
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.6...v7.0.7)
53
+
54
+ **Fixed bugs:**
55
+
56
+ - Web filter param not working in pagination [\#584](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/584) ([mhenrixon](https://github.com/mhenrixon))
57
+
58
+ ## [v7.0.6](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.6) (2021-03-19)
59
+
60
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.5...v7.0.6)
6
61
 
7
62
  **Fixed bugs:**
8
63
 
9
64
  - Deprecation warning for redis behaviour change in 5.0 [\#579](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/579)
65
+ - Consider a match only when both values present [\#586](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/586) ([mhenrixon](https://github.com/mhenrixon))
66
+
67
+ **Closed issues:**
68
+
69
+ - Reaper: undefined method `delete\_suffix' for nil:NilClass [\#585](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/585)
10
70
 
11
71
  ## [v7.0.5](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.5) (2021-03-18)
12
72
 
@@ -86,7 +146,6 @@
86
146
 
87
147
  - Any way to manually clear/reset the changelog history? [\#568](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/568)
88
148
  - Present the entire changelog in its own view [\#569](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/569) ([mhenrixon](https://github.com/mhenrixon))
89
- - Give user full control over adding middleware [\#566](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/566) ([mhenrixon](https://github.com/mhenrixon))
90
149
 
91
150
  **Fixed bugs:**
92
151
 
@@ -103,6 +162,7 @@
103
162
 
104
163
  **Implemented enhancements:**
105
164
 
165
+ - Give user full control over adding middleware [\#566](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/566) ([mhenrixon](https://github.com/mhenrixon))
106
166
  - Fix coverage reporting and add coverage [\#565](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/565) ([mhenrixon](https://github.com/mhenrixon))
107
167
 
108
168
  **Fixed bugs:**
@@ -135,7 +195,7 @@
135
195
  **Fixed bugs:**
136
196
 
137
197
  - 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)
138
- - incorrect `:while\_executing` behavior [\#432](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/432)
198
+ - incorrect `:while_executing` behavior [\#432](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/432)
139
199
  - Fix active check for the worker hash [\#558](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/558) ([mhenrixon](https://github.com/mhenrixon))
140
200
  - Prefer lock\_prefix not unique\_prefix [\#554](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/554) ([mhenrixon](https://github.com/mhenrixon))
141
201
  - Fix issue 432 [\#552](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/552) ([mhenrixon](https://github.com/mhenrixon))
@@ -154,13 +214,9 @@
154
214
 
155
215
  **Closed issues:**
156
216
 
157
- - Documentation incorrect for `delete\_by\_digest` [\#547](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/547)
217
+ - Documentation incorrect for `delete_by_digest` [\#547](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/547)
158
218
  - Locked jobs after kill -9 with while\_executing lock [\#546](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/546)
159
219
 
160
- **Merged pull requests:**
161
-
162
- - Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
163
-
164
220
  ## [v7.0.0.beta26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta26) (2020-10-28)
165
221
 
166
222
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...v7.0.0.beta26)
@@ -178,11 +234,6 @@
178
234
 
179
235
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta25...v6.0.25)
180
236
 
181
- **Implemented enhancements:**
182
-
183
- - Support apartment [\#541](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/541) ([mhenrixon](https://github.com/mhenrixon))
184
- - Support both instance method and class method [\#528](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/528) ([mhenrixon](https://github.com/mhenrixon))
185
-
186
237
  ## [v7.0.0.beta25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta25) (2020-10-26)
187
238
 
188
239
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
@@ -200,6 +251,10 @@
200
251
 
201
252
  - ConnectionPool::TimeoutError and :until\_executed [\#535](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/535)
202
253
 
254
+ **Merged pull requests:**
255
+
256
+ - Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
257
+
203
258
  ## [v7.0.0.beta24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta24) (2020-09-27)
204
259
 
205
260
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta23...v7.0.0.beta24)
@@ -227,7 +282,6 @@
227
282
  **Fixed bugs:**
228
283
 
229
284
  - Ruby reaper incorrectly checks active jobs — removes every active lock as result [\#517](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/517)
230
- - Backport \#465 to 6.x series [\#520](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/520) ([replaid](https://github.com/replaid))
231
285
 
232
286
  ## [v7.0.0.beta22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta22) (2020-06-12)
233
287
 
@@ -301,22 +355,17 @@
301
355
 
302
356
  **Fixed bugs:**
303
357
 
304
- - Deprecate configuration options with `default\_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
358
+ - Deprecate configuration options with `default_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
305
359
  - Fix access to both server and client conflict [\#503](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/503) ([mhenrixon](https://github.com/mhenrixon))
306
- - Use thread-safe digest creation mechanism [\#484](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/484) ([mhenrixon](https://github.com/mhenrixon))
307
360
 
308
361
  **Closed issues:**
309
362
 
310
- - V7 Beta 15 `on\_conflict:` with Hash does not work on server [\#499](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/499)
363
+ - V7 Beta 15 `on_conflict:` with Hash does not work on server [\#499](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/499)
311
364
 
312
365
  ## [v6.0.22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.22) (2020-04-13)
313
366
 
314
367
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta15...v6.0.22)
315
368
 
316
- **Fixed bugs:**
317
-
318
- - \[LockType\] Allow overwriting default lock type at item level [\#497](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/497) ([EmmN](https://github.com/EmmN))
319
-
320
369
  ## [v7.0.0.beta15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta15) (2020-04-10)
321
370
 
322
371
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta14...v7.0.0.beta15)
@@ -328,7 +377,7 @@
328
377
 
329
378
  **Fixed bugs:**
330
379
 
331
- - V7 - `on\_conflict:` no longer accepts a Hash [\#495](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/495)
380
+ - V7 - `on_conflict:` no longer accepts a Hash [\#495](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/495)
332
381
  - Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
333
382
  - Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
334
383
  - Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
@@ -365,10 +414,6 @@
365
414
  - until\_expired is not setting TTL [\#468](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/468)
366
415
  - Fix bug where expiration wasn't set until unlock [\#481](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/481) ([mhenrixon](https://github.com/mhenrixon))
367
416
 
368
- **Merged pull requests:**
369
-
370
- - Allow v7 configuration to work [\#479](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/479) ([mhenrixon](https://github.com/mhenrixon))
371
-
372
417
  ## [v6.0.20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.20) (2020-03-22)
373
418
 
374
419
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta11...v6.0.20)
@@ -415,11 +460,6 @@
415
460
 
416
461
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta9...v6.0.19)
417
462
 
418
- **Fixed bugs:**
419
-
420
- - Fix access to lock [\#476](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/476) ([mhenrixon](https://github.com/mhenrixon))
421
- - Backport v7 fix for conflicts [\#461](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/461) ([mhenrixon](https://github.com/mhenrixon))
422
-
423
463
  ## [v7.0.0.beta9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta9) (2019-12-04)
424
464
 
425
465
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta8...v7.0.0.beta9)
@@ -431,7 +471,7 @@
431
471
 
432
472
  **Closed issues:**
433
473
 
434
- - until\_and\_while\_executing with sidekiq pro `reliable\_scheduler!` [\#411](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/411)
474
+ - until\_and\_while\_executing with sidekiq pro `reliable_scheduler!` [\#411](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/411)
435
475
 
436
476
  ## [v7.0.0.beta8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta8) (2019-11-28)
437
477
 
@@ -444,7 +484,7 @@
444
484
 
445
485
  **Fixed bugs:**
446
486
 
447
- - `while\_executing` has problems at low concurrency [\#384](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/384)
487
+ - `while_executing` has problems at low concurrency [\#384](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/384)
448
488
  - lock: :until\_and\_while\_executing not working for scheduled jobs [\#334](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/334)
449
489
 
450
490
  **Closed issues:**
@@ -481,7 +521,6 @@
481
521
  **Fixed bugs:**
482
522
 
483
523
  - Jobs not pushed when using sidekiq-status [\#412](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/412)
484
- - Fix sidekiq options [\#458](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/458) ([mhenrixon](https://github.com/mhenrixon))
485
524
 
486
525
  **Closed issues:**
487
526
 
@@ -511,18 +550,10 @@
511
550
 
512
551
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.16...v6.0.17)
513
552
 
514
- **Fixed bugs:**
515
-
516
- - Allow redis namespace to work with deletion [\#451](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/451) ([mhenrixon](https://github.com/mhenrixon))
517
-
518
553
  ## [v6.0.16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.16) (2019-11-25)
519
554
 
520
555
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta4...v6.0.16)
521
556
 
522
- **Fixed bugs:**
523
-
524
- - Ensure runtime locks are removed [\#447](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/447) ([mhenrixon](https://github.com/mhenrixon))
525
-
526
557
  ## [v7.0.0.beta4](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta4) (2019-11-25)
527
558
 
528
559
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta3...v7.0.0.beta4)
@@ -544,7 +575,6 @@
544
575
 
545
576
  - Redis is busy running script and script never terminates [\#441](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/441)
546
577
  - Make the ruby reaper plain ruby [\#443](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/443) ([mhenrixon](https://github.com/mhenrixon))
547
- - Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
548
578
 
549
579
  **Closed issues:**
550
580
 
@@ -564,7 +594,7 @@
564
594
 
565
595
  **Closed issues:**
566
596
 
567
- - incorrect `:until\_and\_while\_executing` behavior [\#424](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/424)
597
+ - incorrect `:until_and_while_executing` behavior [\#424](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/424)
568
598
 
569
599
  ## [v7.0.0.beta1](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta1) (2019-10-07)
570
600
 
@@ -583,9 +613,9 @@
583
613
  **Fixed bugs:**
584
614
 
585
615
  - Allow Sidekiq::Context to be used for logging [\#429](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/429) ([mhenrixon](https://github.com/mhenrixon))
616
+ - Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
586
617
  - Reap as many orphans as advertised [\#403](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/403) ([mhenrixon](https://github.com/mhenrixon))
587
618
  - Reaper should remove :INFO keys [\#399](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/399) ([mhenrixon](https://github.com/mhenrixon))
588
- - Convert v5 locks when needed [\#375](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/375) ([mhenrixon](https://github.com/mhenrixon))
589
619
 
590
620
  **Merged pull requests:**
591
621
 
@@ -602,14 +632,11 @@
602
632
  **Implemented enhancements:**
603
633
 
604
634
  - Lock both worker and queue [\#274](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/274)
605
- - Copy working setup from master [\#420](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/420) ([mhenrixon](https://github.com/mhenrixon))
606
635
 
607
636
  **Fixed bugs:**
608
637
 
609
638
  - Duplicate job was pushed \( v6.0.13 \) [\#414](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/414)
610
639
  - Constant SidekiqUniqueJobs::Web::Digests not found [\#396](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/396)
611
- - Include redis directory [\#430](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/430) ([mhenrixon](https://github.com/mhenrixon))
612
- - Fix v6 [\#428](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/428) ([mhenrixon](https://github.com/mhenrixon))
613
640
 
614
641
  **Closed issues:**
615
642
 
@@ -635,7 +662,7 @@
635
662
 
636
663
  **Closed issues:**
637
664
 
638
- - Unique args in combination with sidekiq cron contains `\_aj\_symbol\_keys` [\#363](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/363)
665
+ - Unique args in combination with sidekiq cron contains `_aj_symbol_keys` [\#363](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/363)
639
666
  - Low quality piece of shit [\#360](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/360)
640
667
  - Passthrough has been deprecated and will be removed in redis-namespace 2.0 [\#338](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/338)
641
668
 
@@ -664,6 +691,7 @@
664
691
  - Version 6: lets you schedule job with missing arguments [\#351](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/351)
665
692
  - Version 6 Ignores Jobs Enqueued in Version 5 [\#345](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/345)
666
693
  - Job will not enqueue even with no existing match [\#342](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/342)
694
+ - Convert v5 locks when needed [\#375](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/375) ([mhenrixon](https://github.com/mhenrixon))
667
695
 
668
696
  **Closed issues:**
669
697
 
@@ -747,10 +775,6 @@
747
775
 
748
776
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.6...v5.0.11)
749
777
 
750
- **Fixed bugs:**
751
-
752
- - Always Remove Job ID from uniquejobs Hash [\#347](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/347) ([chadrschroeder](https://github.com/chadrschroeder))
753
-
754
778
  **Closed issues:**
755
779
 
756
780
  - concurrent-ruby 1.1.1 is causing this gem to break [\#340](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/340)
@@ -980,13 +1004,6 @@
980
1004
  - Code smells [\#275](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/275) ([mhenrixon](https://github.com/mhenrixon))
981
1005
  - Reject while scheduling [\#273](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/273) ([mhenrixon](https://github.com/mhenrixon))
982
1006
  - Improve testing [\#272](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/272) ([mhenrixon](https://github.com/mhenrixon))
983
-
984
- ## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
985
-
986
- [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
987
-
988
- **Implemented enhancements:**
989
-
990
1007
  - Until and while executing [\#271](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/271) ([mhenrixon](https://github.com/mhenrixon))
991
1008
  - Solidify master [\#270](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/270) ([mhenrixon](https://github.com/mhenrixon))
992
1009
  - Minor adjustments [\#268](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/268) ([mhenrixon](https://github.com/mhenrixon))
@@ -997,25 +1014,29 @@
997
1014
 
998
1015
  - Allow `jobs keys` to default to listing all keys [\#252](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/252) ([soundasleep](https://github.com/soundasleep))
999
1016
 
1017
+ **Merged pull requests:**
1018
+
1019
+ - Improve documentation [\#269](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/269) ([mhenrixon](https://github.com/mhenrixon))
1020
+ - Remove unnecessary monkey patches for String [\#262](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/262) ([zormandi](https://github.com/zormandi))
1021
+ - README \> While Executing: remove unnecessary word [\#260](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/260) ([TimCannady](https://github.com/TimCannady))
1022
+ - Don't skip monkeypatches if ActiveSupport present [\#248](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/248) ([dleavitt](https://github.com/dleavitt))
1023
+ - Better runtime locks [\#241](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/241) ([mhenrixon](https://github.com/mhenrixon))
1024
+
1025
+ ## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
1026
+
1027
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
1028
+
1000
1029
  **Closed issues:**
1001
1030
 
1002
1031
  - Incomplete sentence in README [\#264](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/264)
1003
1032
  - ActiveJob and Sidekiq::Worker [\#259](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/259)
1004
1033
  - ActiveJob and Sidekiq::Worker [\#258](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/258)
1005
- - Non-unique jobs can be added even when `sidekiq\_options unique: :until\_executed` [\#251](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/251)
1034
+ - Non-unique jobs can be added even when `sidekiq_options unique: :until_executed` [\#251](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/251)
1006
1035
  - Trouble with "inline" mode [\#243](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/243)
1007
1036
  - Sidekiq::Worker.set not working with sidekiq-unique-jobs [\#242](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/242)
1008
1037
  - sidekiq-unique-job with ActiveJob [\#238](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/238)
1009
1038
  - Deadlock using :while\_executing? [\#233](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/233)
1010
1039
 
1011
- **Merged pull requests:**
1012
-
1013
- - Improve documentation [\#269](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/269) ([mhenrixon](https://github.com/mhenrixon))
1014
- - Remove unnecessary monkey patches for String [\#262](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/262) ([zormandi](https://github.com/zormandi))
1015
- - README \> While Executing: remove unnecessary word [\#260](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/260) ([TimCannady](https://github.com/TimCannady))
1016
- - Don't skip monkeypatches if ActiveSupport present [\#248](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/248) ([dleavitt](https://github.com/dleavitt))
1017
- - Better runtime locks [\#241](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/241) ([mhenrixon](https://github.com/mhenrixon))
1018
-
1019
1040
  ## [v5.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10) (2017-08-19)
1020
1041
 
1021
1042
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.9...v5.0.10)
@@ -1226,7 +1247,7 @@
1226
1247
 
1227
1248
  - Can't schedule a job from another job [\#151](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/151)
1228
1249
  - perform\_in not working in version 4.0.9 [\#150](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/150)
1229
- - `unique: until\_and\_while\_executing` not working as expected [\#146](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/146)
1250
+ - `unique: until_and_while_executing` not working as expected [\#146](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/146)
1230
1251
  - while\_executing still runs duplicate tasks [\#136](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/136)
1231
1252
  - Version 4 Upgrade [\#133](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/133)
1232
1253
 
@@ -1367,7 +1388,7 @@
1367
1388
  - Testing [\#103](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/103)
1368
1389
  - Active Job [\#102](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/102)
1369
1390
  - Why is SidekiqUnique behaviour applied to regular Workers? [\#100](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/100)
1370
- - 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)
1391
+ - 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)
1371
1392
  - Scheduled jobs are not unlocked when deleted [\#97](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/97)
1372
1393
  - Testing functions should be moved out of production code [\#95](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/95)
1373
1394
  - Jobs can unlock mutexes they don't own [\#94](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/94)
@@ -1401,6 +1422,7 @@
1401
1422
  - Do not unlock on sidekiq shutdown [\#87](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/87) ([deltaroe](https://github.com/deltaroe))
1402
1423
  - 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))
1403
1424
  - 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))
1425
+ - 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))
1404
1426
  - Duplicate Payload logging configuration [\#81](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/81) ([jprincipe](https://github.com/jprincipe))
1405
1427
  - output log if not unique [\#79](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/79) ([sonots](https://github.com/sonots))
1406
1428
  - Checking Sidekiq::Testing.inline? on testing strategy and connector [\#75](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/75) ([Draiken](https://github.com/Draiken))
@@ -1416,7 +1438,6 @@
1416
1438
 
1417
1439
  **Merged pull requests:**
1418
1440
 
1419
- - 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))
1420
1441
  - 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))
1421
1442
 
1422
1443
  ## [v3.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v3.0.10) (2014-11-19)
@@ -1498,7 +1519,6 @@
1498
1519
  - Clarify README about unique expiration [\#36](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/36) ([spacemunkay](https://github.com/spacemunkay))
1499
1520
  - Add option to make jobs unique on all queues [\#32](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/32) ([robinmessage](https://github.com/robinmessage))
1500
1521
  - Fix homepage in gemspec [\#29](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/29) ([tmaier](https://github.com/tmaier))
1501
- - Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
1502
1522
 
1503
1523
  ## [v2.7.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v2.7.0) (2013-11-24)
1504
1524
 
@@ -1516,7 +1536,8 @@
1516
1536
 
1517
1537
  - Make unlock/yield order configurable. [\#21](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/21) ([endofunky](https://github.com/endofunky))
1518
1538
  - 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))
1519
- - 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))
1539
+ - 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))
1540
+ - Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
1520
1541
  - 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))
1521
1542
  - 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))
1522
1543
  - 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 [![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://travis-ci.org/mhenrixon/sidekiq-unique-jobs.svg?branch=master)](https://travis-ci.org/mhenrixon/sidekiq-unique-jobs) [![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)
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
 
@@ -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/integration/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/integration/sidekiq_unique_jobs/lock/until_and_while_executing_spec.rb)
909
- - [spec/integration/sidekiq_unique_jobs/lock/until_executed_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/integration/sidekiq_unique_jobs/lock/until_executed_spec.rb)
910
- - [spec/integration/sidekiq_unique_jobs/lock/until_expired_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/integration/sidekiq_unique_jobs/lock/until_expired_spec.rb)
911
- - [spec/integration/sidekiq_unique_jobs/lock/while_executing_reject_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/integration/sidekiq_unique_jobs/lock/while_executing_reject_spec.rb)
912
- - [spec/integration/sidekiq_unique_jobs/lock/while_executing_spec.rb](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/spec/integration/sidekiq_unique_jobs/lock/while_executing_spec.rb)
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
 
@@ -68,8 +68,8 @@ module SidekiqUniqueJobs
68
68
  end
69
69
 
70
70
  [
71
- total_size,
72
- result[0], # next_cursor
71
+ total_size.to_i,
72
+ result[0].to_i, # next_cursor
73
73
  result[1].map { |entry| load_json(entry[0]) }, # entries
74
74
  ]
75
75
  end
@@ -104,8 +104,8 @@ module SidekiqUniqueJobs
104
104
  end
105
105
 
106
106
  [
107
- total_size,
108
- digests[0], # next_cursor
107
+ total_size.to_i,
108
+ digests[0].to_i, # next_cursor
109
109
  digests[1].map { |digest, score| Lock.new(digest, time: score) }, # entries
110
110
  ]
111
111
  end
@@ -124,7 +124,7 @@ module SidekiqUniqueJobs
124
124
  attr_reader :attempt
125
125
 
126
126
  def unlock_with_callback
127
- return log_warn("might need to be unlocked manually") unless unlock
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("unlocked successfully but the #after_unlock callback failed!")
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 "couldn't unlock digest: #{item[LOCK_DIGEST]} #{item[JID]}"
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(drift(config.ttl))
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
- return yield if pop_queued(conn)
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 || 0)
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.to_i * CLOCK_DRIFT_FACTOR).to_i + 2
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
  #
@@ -340,7 +346,7 @@ module SidekiqUniqueJobs
340
346
  LIMIT => item[LOCK_LIMIT],
341
347
  TIMEOUT => item[LOCK_TIMEOUT],
342
348
  TTL => item[LOCK_TTL],
343
- LOCK => config.type,
349
+ TYPE => config.type,
344
350
  LOCK_ARGS => item[LOCK_ARGS],
345
351
  TIME => now_f,
346
352
  )
@@ -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
- logger.debug(message_or_exception, &block)
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
- logger.info(message_or_exception, &block)
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
- logger.warn(message_or_exception, &block)
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
- logger.error(message_or_exception, &block)
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
- logger.fatal(message_or_exception, &block)
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) if logger_respond_to_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
- return klazz.class if klazz.is_a?(Sidekiq::Worker) # sidekiq v6.x
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
  #
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.0.6"
6
+ VERSION = "7.0.11"
7
7
  end
@@ -19,8 +19,11 @@ module SidekiqUniqueJobs
19
19
  @count = (params[:count] || 100).to_i
20
20
  @current_cursor = params[:cursor]
21
21
  @prev_cursor = params[:prev_cursor]
22
- @pagination = { pattern: @filter, cursor: @current_cursor, page_size: @count }
23
- @total_size, @next_cursor, @changelogs = changelog.page(**@pagination)
22
+ @total_size, @next_cursor, @changelogs = changelog.page(
23
+ cursor: @current_cursor,
24
+ pattern: @filter,
25
+ page_size: @count,
26
+ )
24
27
 
25
28
  erb(unique_template(:changelogs))
26
29
  end
@@ -36,8 +39,12 @@ module SidekiqUniqueJobs
36
39
  @count = (params[:count] || 100).to_i
37
40
  @current_cursor = params[:cursor]
38
41
  @prev_cursor = params[:prev_cursor]
39
- @pagination = { pattern: @filter, cursor: @current_cursor, page_size: @count }
40
- @total_size, @next_cursor, @locks = digests.page(**@pagination)
42
+
43
+ @total_size, @next_cursor, @locks = digests.page(
44
+ cursor: @current_cursor,
45
+ pattern: @filter,
46
+ page_size: @count,
47
+ )
41
48
 
42
49
  erb(unique_template(:locks))
43
50
  end
@@ -13,7 +13,9 @@ module SidekiqUniqueJobs
13
13
  VIEW_PATH = File.expand_path("../web/views", __dir__).freeze
14
14
  #
15
15
  # @return [Array<String>] safe params
16
- SAFE_CPARAMS = %w[cursor prev_cursor].freeze
16
+ SAFE_CPARAMS = %w[
17
+ filter count cursor prev_cursor poll direction
18
+ ].freeze
17
19
 
18
20
  extend self
19
21
 
@@ -67,10 +69,8 @@ module SidekiqUniqueJobs
67
69
  # @return [String] a url safe parameter string
68
70
  #
69
71
  def cparams(options)
70
- # stringify
71
- options.transform_keys(&:to_s)
72
-
73
- params.merge(options).map do |key, value|
72
+ stringified_options = options.transform_keys(&:to_s)
73
+ params.merge(stringified_options).map do |key, value|
74
74
  next unless SAFE_CPARAMS.include?(key)
75
75
 
76
76
  "#{key}=#{CGI.escape(value.to_s)}"
@@ -1,10 +1,10 @@
1
1
  <ul class="pagination pull-right flip">
2
2
  <% if @prev_cursor %>
3
- <li>
4
- <a href="<%= url %>?<%= cparams(cursor: @prev_cursor, prev_cursor: @next_cursor) %>">Previous <%= @count %></a>
5
- </li>
3
+ <li>
4
+ <a href="<%= url %>?<%= cparams(filter: @filter, cursor: @prev_cursor, prev_cursor: @next_cursor) %>">Previous <%= @count %></a>
5
+ </li>
6
6
  <% end %>
7
7
  <li>
8
- <a href="<%= url %>?<%= cparams(cursor: @next_cursor, prev_cursor: @current_cursor) %>">Next <%= @count %></a>
8
+ <a href="<%= url %>?<%= cparams(filter: @filter, cursor: @next_cursor, prev_cursor: @current_cursor) %>">Next <%= @count %></a>
9
9
  </li>
10
10
  </ul>
@@ -36,7 +36,7 @@
36
36
  </thead>
37
37
  <tbody>
38
38
  <% @changelogs.each do |changelog| %>
39
- <tr>
39
+ <tr class="changelog-row">
40
40
  <td><%= safe_relative_time(changelog["time"]) %></td>
41
41
  <td><%= changelog["digest"] %></td>
42
42
  <td><%= changelog["script"] %></td>
@@ -11,7 +11,7 @@
11
11
  <%= t('Filter') %>
12
12
  </button>
13
13
  </form>
14
- <% if @locks.any? && @total_size > @count.to_i %>
14
+ <% if @locks.any? && @total_size > @count %>
15
15
  <div class="col-sm-4">
16
16
  <%= erb unique_template(:_paging), locals: { url: "#{root_path}locks" } %>
17
17
  </div>
@@ -30,20 +30,22 @@
30
30
  </tr>
31
31
  </thead>
32
32
  <% @locks.each do |lock| %>
33
- <tr>
34
- <td>
35
- <form action="<%= root_path %>locks/<%= lock.key %>/delete" method="get">
36
- <%= csrf_tag %>
37
- <input name="lock" value="<%= h lock.key %>" type="hidden" />
38
- <input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
39
- </form>
40
- </td>
41
- <td><a href="<%= root_path %>locks/<%= lock.key %>"><%= lock.key %></a></td>
42
- <td><%= lock.info["lock"] %></th>
43
- <td><%= lock.locked.count %></td>
44
- <td><%= safe_relative_time(lock.created_at) %></td>
45
- </tr>
46
- <% end %>
33
+ <tbody>
34
+ <tr class="lock-row">
35
+ <td>
36
+ <form action="<%= root_path %>locks/<%= lock.key %>/delete" method="get">
37
+ <%= csrf_tag %>
38
+ <input name="lock" value="<%= h lock.key %>" type="hidden" />
39
+ <input class="btn btn-danger btn-xs" type="submit" name="delete" value="<%= t('Delete') %>" data-confirm="<%= t('AreYouSure') %>" />
40
+ </form>
41
+ </td>
42
+ <td><a href="<%= root_path %>locks/<%= lock.key %>"><%= lock.key %></a></td>
43
+ <td><%= lock.info["lock"] %></td>
44
+ <td><%= lock.locked.count %></td>
45
+ <td><%= safe_relative_time(lock.created_at) %></td>
46
+ </tr>
47
+ </tbody>
48
+ <% end %>
47
49
  </table>
48
50
  <form action="<%= root_path %>locks/delete_all" method="get">
49
51
  <input class="btn btn-danger btn-xs" type="submit" name="delete_all" value="<%= t('DeleteAll') %>" data-confirm="<%= t('AreYouSure') %>" />
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.6
4
+ version: 7.0.11
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-03-19 00:00:00.000000000 Z
11
+ date: 2021-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brpoplpush-redis_script