sidekiq-unique-jobs 7.0.0.beta28 → 7.0.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq-unique-jobs might be problematic. Click here for more details.

Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +98 -18
  3. data/README.md +169 -37
  4. data/lib/sidekiq-unique-jobs.rb +0 -2
  5. data/lib/sidekiq_unique_jobs.rb +4 -1
  6. data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
  7. data/lib/sidekiq_unique_jobs/changelog.rb +11 -4
  8. data/lib/sidekiq_unique_jobs/constants.rb +1 -0
  9. data/lib/sidekiq_unique_jobs/digests.rb +1 -1
  10. data/lib/sidekiq_unique_jobs/json.rb +7 -1
  11. data/lib/sidekiq_unique_jobs/lock.rb +31 -1
  12. data/lib/sidekiq_unique_jobs/lock_config.rb +2 -0
  13. data/lib/sidekiq_unique_jobs/lua/lock.lua +10 -11
  14. data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +8 -7
  15. data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +9 -2
  16. data/lib/sidekiq_unique_jobs/middleware.rb +0 -57
  17. data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +9 -8
  18. data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +1 -1
  19. data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
  20. data/lib/sidekiq_unique_jobs/orphans/manager.rb +13 -3
  21. data/lib/sidekiq_unique_jobs/orphans/reaper.rb +10 -0
  22. data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +14 -5
  23. data/lib/sidekiq_unique_jobs/redis/entity.rb +9 -3
  24. data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +27 -0
  25. data/lib/sidekiq_unique_jobs/server.rb +48 -0
  26. data/lib/sidekiq_unique_jobs/timer_task.rb +78 -0
  27. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  28. data/lib/sidekiq_unique_jobs/web.rb +26 -9
  29. data/lib/sidekiq_unique_jobs/web/helpers.rb +24 -3
  30. data/lib/sidekiq_unique_jobs/web/views/changelogs.erb +54 -0
  31. data/lib/sidekiq_unique_jobs/web/views/locks.erb +1 -1
  32. metadata +13 -8
  33. data/lib/sidekiq_unique_jobs/profiler.rb +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13bc0a51e575fe6e019fa0e47b16875733eaf3c674913caff86c8e9e25b03212
4
- data.tar.gz: 4798530068d809e896baf5a5091eb81f31f72adec762232e606c3b9c59946889
3
+ metadata.gz: f03dcf3b8db660243a4a018b9f925ac9dc38031d9bdc95d303f9f70cfe72c3dd
4
+ data.tar.gz: 77a841700f2d99aefe2bd362cdd960cb2c95dd151058f630f6d5559b6451c946
5
5
  SHA512:
6
- metadata.gz: aad36721efc247b274437dbc327d21bf4c014d482962ce361cad6a7b2fbf63874d32121ac4f2f44d14197169c7c8ac9bb268b7ad8851d2cf407e9c47503524ce
7
- data.tar.gz: b1308b72466f8a7ec8150e0997eab097c17fcabd7d554811e0ddd3ff547105ff9fa36442318bd9db182a3b6b130e755f6ac4fce93d863cb6c60ae3fe4cadf5c2
6
+ metadata.gz: 1435327d1917f52e3ab6d7c16fd5cd4985bdee2db1005249b551bb10c207020df11440c1eb65ac8cd959731c96db3e8e02df3975724915dc4802622ff38001bf
7
+ data.tar.gz: 330d28efc520b4d3cb5c7df5561f8afd27a9d7a138edd3bcca6a642185433449bdba7ecf12d9a6d373cbe9f5ecf5b8c7072726e0b328f890e2ea96c74d2c9c1b
data/CHANGELOG.md CHANGED
@@ -1,12 +1,98 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/HEAD)
3
+ ## [v7.0.2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.2) (2021-02-08)
4
4
 
5
- [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta27...HEAD)
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.1...v7.0.2)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Lock not getting properly cleared for some jobs [\#560](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/560)
10
+ - while\_executing + raise let non-unique jobs to be executed [\#534](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/534)
11
+ - delete\_by\_digest does not work with the msg\['unique\_digest'\] value available in sidekiq\_retries\_exhausted [\#532](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/532)
12
+ - Multiple jobs running at the same time [\#531](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/531)
13
+ - Unable to setup in standalone Ruby project [\#523](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/523)
14
+ - v7.0.0.beta15 Can't push new jobs to queue [\#501](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/501)
15
+ - Reaper doesn't work - lua or ruby [\#498](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/498)
16
+ - Tasks run once, and then there is no launch [\#464](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/464)
17
+ - Jobs executing and immediately returning [\#418](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/418)
18
+ - until\_and\_while\_executing + sidekiq retry mechanism [\#395](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/395)
19
+ - Failed jobs waiting to be retried are not considered when fetching uniqueness [\#394](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/394)
20
+ - Fix that :PRIMED keys are seemingly not removed [\#574](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/574) ([mhenrixon](https://github.com/mhenrixon))
21
+
22
+ **Closed issues:**
23
+
24
+ - Just some clarification on the documentation. [\#530](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/530)
25
+ - Unique Digests dashboard not filtering the full set of results [\#529](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/529)
26
+ - after\_unlock isn't called unless it's a class method [\#526](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/526)
27
+ - The job gets JID and goes to dead right away [\#522](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/522)
28
+ - Able to assign customise Redis setup [\#509](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/509)
29
+ - SidekiqUniqueJobs::UniqueArgs\#create\_digest is getting called twice [\#391](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/391)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - Fix example url in documentation [\#572](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/572) ([yboulkaid](https://github.com/yboulkaid))
34
+
35
+ ## [v7.0.1](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.1) (2021-01-22)
36
+
37
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0...v7.0.1)
38
+
39
+ **Implemented enhancements:**
40
+
41
+ - Any way to manually clear/reset the changelog history? [\#568](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/568)
42
+ - Present the entire changelog in its own view [\#569](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/569) ([mhenrixon](https://github.com/mhenrixon))
43
+
44
+ **Fixed bugs:**
45
+
46
+ - Fix configuration [\#570](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/570) ([mhenrixon](https://github.com/mhenrixon))
47
+ - Prefer lock\_prefix not unique\_prefix [\#554](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/554) ([mhenrixon](https://github.com/mhenrixon))
48
+
49
+ **Closed issues:**
50
+
51
+ - undefined method 'delete\_by\_digest' for SidekiqUniqueJobs::Digests:Class [\#567](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/567)
52
+ - Rejected jobs are still displayed as 'Queued' with gem 'sidekiq-status' on /sidekiq/statuses [\#564](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/564)
53
+
54
+ ## [v7.0.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0) (2021-01-20)
55
+
56
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta29...v7.0.0)
57
+
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
+ - Fix coverage reporting and add coverage [\#565](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/565) ([mhenrixon](https://github.com/mhenrixon))
62
+
63
+ **Fixed bugs:**
64
+
65
+ - Race condition in ruby reaper [\#559](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/559)
66
+ - Fix until and while executed and improve documentation [\#397](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/397)
67
+ - Fix race condition to avoid reaping active jobs [\#563](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/563) ([mhenrixon](https://github.com/mhenrixon))
68
+
69
+ **Closed issues:**
70
+
71
+ - Is it possible to have a :until\_executed lock with an expiration time? [\#524](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/524)
72
+
73
+ ## [v7.0.0.beta29](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta29) (2021-01-16)
74
+
75
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta28...v7.0.0.beta29)
76
+
77
+ **Fixed bugs:**
78
+
79
+ - Ruby Reaper active check incorrect [\#557](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/557)
80
+ - Routes with authentication should work with web [\#562](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/562) ([mhenrixon](https://github.com/mhenrixon))
81
+ - Fix active check for the worker hash [\#558](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/558) ([mhenrixon](https://github.com/mhenrixon))
82
+
83
+ **Closed issues:**
84
+
85
+ - Can't add the lock tab o nthe website when there is authentication through devise [\#561](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/561)
86
+
87
+ ## [v7.0.0.beta28](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta28) (2021-01-07)
88
+
89
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta27...v7.0.0.beta28)
6
90
 
7
91
  **Fixed bugs:**
8
92
 
9
93
  - 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)
94
+ - incorrect `:while\_executing` behavior [\#432](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/432)
95
+ - Fix issue 432 [\#552](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/552) ([mhenrixon](https://github.com/mhenrixon))
10
96
 
11
97
  ## [v7.0.0.beta27](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta27) (2020-11-03)
12
98
 
@@ -19,6 +105,7 @@
19
105
  **Fixed bugs:**
20
106
 
21
107
  - Rename lock\_args to lock\_args\_method [\#551](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/551) ([mhenrixon](https://github.com/mhenrixon))
108
+ - Fix RubyReaper active? [\#538](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/538) ([tanner-rutgers](https://github.com/tanner-rutgers))
22
109
 
23
110
  **Closed issues:**
24
111
 
@@ -33,6 +120,7 @@
33
120
 
34
121
  - How to disable Reaper [\#543](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/543)
35
122
  - Allow disabling of reaper [\#544](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/544) ([mhenrixon](https://github.com/mhenrixon))
123
+ - Bump rubocop [\#539](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/539) ([mhenrixon](https://github.com/mhenrixon))
36
124
 
37
125
  **Merged pull requests:**
38
126
 
@@ -51,14 +139,9 @@
51
139
 
52
140
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
53
141
 
54
- **Implemented enhancements:**
55
-
56
- - Bump rubocop [\#539](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/539) ([mhenrixon](https://github.com/mhenrixon))
57
-
58
142
  **Fixed bugs:**
59
143
 
60
144
  - Ruby reaper not working, active jobs queried incorrectly [\#537](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/537)
61
- - Fix RubyReaper active? [\#538](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/538) ([tanner-rutgers](https://github.com/tanner-rutgers))
62
145
 
63
146
  **Closed issues:**
64
147
 
@@ -171,6 +254,7 @@
171
254
 
172
255
  - Deprecate configuration options with `default\_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
173
256
  - Fix access to both server and client conflict [\#503](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/503) ([mhenrixon](https://github.com/mhenrixon))
257
+ - Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
174
258
 
175
259
  **Closed issues:**
176
260
 
@@ -201,7 +285,6 @@
201
285
  - Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
202
286
  - Fix access to hash members [\#496](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/496) ([mhenrixon](https://github.com/mhenrixon))
203
287
  - Fix cursor assignment [\#494](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/494) ([mhenrixon](https://github.com/mhenrixon))
204
- - Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
205
288
 
206
289
  ## [v7.0.0.beta14](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta14) (2020-03-30)
207
290
 
@@ -270,7 +353,6 @@
270
353
  - Rename remaining unique\_\* keys to lock\_\* [\#475](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/475) ([mhenrixon](https://github.com/mhenrixon))
271
354
  - Split calculator into two separate [\#474](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/474) ([mhenrixon](https://github.com/mhenrixon))
272
355
  - Prepare for improving tests [\#473](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/473) ([mhenrixon](https://github.com/mhenrixon))
273
- - Update gemspec: thor [\#465](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/465) ([masawo](https://github.com/masawo))
274
356
 
275
357
  **Fixed bugs:**
276
358
 
@@ -298,6 +380,7 @@
298
380
  **Implemented enhancements:**
299
381
 
300
382
  - Keys without TTL [\#417](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/417)
383
+ - Update gemspec: thor [\#465](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/465) ([masawo](https://github.com/masawo))
301
384
  - Various changes to test and verify reliability [\#463](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/463) ([mhenrixon](https://github.com/mhenrixon))
302
385
 
303
386
  **Closed issues:**
@@ -453,7 +536,6 @@
453
536
  **Fixed bugs:**
454
537
 
455
538
  - Allow Sidekiq::Context to be used for logging [\#429](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/429) ([mhenrixon](https://github.com/mhenrixon))
456
- - Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
457
539
  - Reap as many orphans as advertised [\#403](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/403) ([mhenrixon](https://github.com/mhenrixon))
458
540
  - Reaper should remove :INFO keys [\#399](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/399) ([mhenrixon](https://github.com/mhenrixon))
459
541
 
@@ -480,6 +562,7 @@
480
562
  - Constant SidekiqUniqueJobs::Web::Digests not found [\#396](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/396)
481
563
  - Include redis directory [\#430](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/430) ([mhenrixon](https://github.com/mhenrixon))
482
564
  - Fix v6 [\#428](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/428) ([mhenrixon](https://github.com/mhenrixon))
565
+ - Fix sidekiq develop [\#426](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/426) ([mhenrixon](https://github.com/mhenrixon))
483
566
 
484
567
  **Closed issues:**
485
568
 
@@ -712,6 +795,7 @@
712
795
 
713
796
  - Dead jobs [\#308](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/308) ([mhenrixon](https://github.com/mhenrixon))
714
797
  - Fix require path for sidekiq\_unique\_jobs/web [\#305](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/305) ([soundasleep](https://github.com/soundasleep))
798
+ - Fix README [\#298](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/298) ([mhenrixon](https://github.com/mhenrixon))
715
799
 
716
800
  ## [v6.0.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0) (2018-07-27)
717
801
 
@@ -739,7 +823,6 @@
739
823
  **Implemented enhancements:**
740
824
 
741
825
  - Sidekiq web [\#297](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/297) ([mhenrixon](https://github.com/mhenrixon))
742
- - Document code [\#296](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/296) ([mhenrixon](https://github.com/mhenrixon))
743
826
  - Rename to `unique:` to `lock:` [\#295](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/295) ([mhenrixon](https://github.com/mhenrixon))
744
827
 
745
828
  **Closed issues:**
@@ -750,7 +833,7 @@
750
833
  **Merged pull requests:**
751
834
 
752
835
  - Adds changelog entry [\#299](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/299) ([mhenrixon](https://github.com/mhenrixon))
753
- - Fix README [\#298](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/298) ([mhenrixon](https://github.com/mhenrixon))
836
+ - Readme [\#288](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/288) ([mhenrixon](https://github.com/mhenrixon))
754
837
 
755
838
  ## [v6.0.0.rc6](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc6) (2018-07-15)
756
839
 
@@ -764,10 +847,6 @@
764
847
 
765
848
  - Locking with retries [\#289](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/289)
766
849
 
767
- **Merged pull requests:**
768
-
769
- - Readme [\#288](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/288) ([mhenrixon](https://github.com/mhenrixon))
770
-
771
850
  ## [v6.0.0.rc5](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc5) (2018-06-30)
772
851
 
773
852
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.0.rc4...v6.0.0.rc5)
@@ -783,6 +862,7 @@
783
862
 
784
863
  **Implemented enhancements:**
785
864
 
865
+ - Document code [\#296](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/296) ([mhenrixon](https://github.com/mhenrixon))
786
866
  - Prepare for v6 [\#286](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/286) ([mhenrixon](https://github.com/mhenrixon))
787
867
  - Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
788
868
 
@@ -901,6 +981,7 @@
901
981
 
902
982
  - Various improvements [\#240](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/240) ([mhenrixon](https://github.com/mhenrixon))
903
983
  - Fix: uninitialized constant CustomQueueJob on rspec [\#239](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/239) ([dalpo](https://github.com/dalpo))
984
+ - Increase sleep delay in WhileExecuting\#synchronize [\#204](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/204) ([dsander](https://github.com/dsander))
904
985
 
905
986
  ## [v5.0.9](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.9) (2017-07-06)
906
987
 
@@ -1017,7 +1098,6 @@
1017
1098
 
1018
1099
  **Merged pull requests:**
1019
1100
 
1020
- - Increase sleep delay in WhileExecuting\#synchronize [\#204](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/204) ([dsander](https://github.com/dsander))
1021
1101
  - Ensure job ID removed from uniquejobs hash [\#200](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/200) ([carlosmartinez](https://github.com/carlosmartinez))
1022
1102
  - unique args need to be an array [\#194](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/194) ([pboling](https://github.com/pboling))
1023
1103
 
@@ -1390,7 +1470,6 @@
1390
1470
  - Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
1391
1471
  - 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))
1392
1472
  - 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))
1393
- - Adding the unique prefix option [\#8](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/8) ([KensoDev](https://github.com/KensoDev))
1394
1473
  - Remove unnecessary log messages [\#7](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/7) ([marclennox](https://github.com/marclennox))
1395
1474
 
1396
1475
  ## [v2.3.2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v2.3.2) (2012-09-27)
@@ -1403,6 +1482,7 @@
1403
1482
 
1404
1483
  **Merged pull requests:**
1405
1484
 
1485
+ - Adding the unique prefix option [\#8](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/8) ([KensoDev](https://github.com/KensoDev))
1406
1486
  - Fix multiple bugs, cleaned up dependencies, and added a feature [\#4](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/4) ([kemper-blinq](https://github.com/kemper-blinq))
1407
1487
  - Dependency on sidekiq 2.2.0 and up [\#3](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/3) ([philostler](https://github.com/philostler))
1408
1488
 
data/README.md CHANGED
@@ -3,9 +3,12 @@
3
3
  <!-- MarkdownTOC -->
4
4
 
5
5
  - [Introduction](#introduction)
6
- - [Requirements](#requirements)
7
- - [Installation](#installation)
6
+ - [Usage](#usage)
7
+ - [Installation](#installation)
8
+ - [Add the middleware](#add-the-middleware)
9
+ - [Your first worker](#your-first-worker)
8
10
  - [Support Me](#support-me)
11
+ - [Requirements](#requirements)
9
12
  - [General Information](#general-information)
10
13
  - [Global Configuration](#global-configuration)
11
14
  - [debug_lua](#debug_lua)
@@ -21,6 +24,8 @@
21
24
  - [lock_prefix](#lock_prefix)
22
25
  - [lock_info](#lock_info)
23
26
  - [Worker Configuration](#worker-configuration)
27
+ - [lock_info](#lock_info-1)
28
+ - [lock_prefix](#lock_prefix-1)
24
29
  - [lock_ttl](#lock_ttl-1)
25
30
  - [lock_timeout](#lock_timeout-1)
26
31
  - [unique_across_queues](#unique_across_queues)
@@ -39,13 +44,15 @@
39
44
  - [replace](#replace)
40
45
  - [Reschedule](#reschedule)
41
46
  - [Custom Strategies](#custom-strategies)
42
- - [Usage](#usage)
47
+ - [Usage](#usage-1)
43
48
  - [Finer Control over Uniqueness](#finer-control-over-uniqueness)
44
49
  - [After Unlock Callback](#after-unlock-callback)
45
50
  - [Logging](#logging)
46
51
  - [Cleanup Dead Locks](#cleanup-dead-locks)
47
52
  - [Other Sidekiq gems](#other-sidekiq-gems)
53
+ - [apartment-sidekiq](#apartment-sidekiq)
48
54
  - [sidekiq-global_id](#sidekiq-global_id)
55
+ - [sidekiq-status](#sidekiq-status)
49
56
  - [Debugging](#debugging)
50
57
  - [Sidekiq Web](#sidekiq-web)
51
58
  - [Show Locks](#show-locks)
@@ -61,7 +68,7 @@
61
68
 
62
69
  ## Introduction
63
70
 
64
- This gem adds unique constraints to the sidekiq queues. The uniqueness is achieved by acquiring locks for a hash of a queue name, a worker class, and job's arguments. Only one lock for a given hash can be acquired. What happens when a lock can't be acquired is governed by a chosen strategy.
71
+ This gem adds unique constraints to the sidekiq queues. The uniqueness is achieved by acquiring locks for a hash of a queue name, a worker class, and job's arguments. By default, only one lock for a given hash can be acquired. What happens when a lock can't be acquired is governed by a chosen `on_conflict`strategy.
65
72
 
66
73
  This is the documentation for the master branch. You can find the documentation for each release by navigating to its tag.
67
74
 
@@ -71,20 +78,9 @@ Here are links to some of the old versions
71
78
  - [v5.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10)
72
79
  - [v4.0.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18)
73
80
 
74
- ## Requirements
75
-
76
- - Sidekiq `>= 4.0` (`>= 5.2` recommended)
77
- - Ruby:
78
- - MRI `>= 2.3` (`>= 2.5` recommended)
79
- - JRuby `>= 9.0` (`>= 9.2` recommended)
80
- - Truffleruby
81
- - Redis Server `>= 3.0.2` (`>= 3.2` recommended)
82
- - [ActiveJob officially not supported][48]
83
- - [redis-namespace officially not supported][49]
84
-
85
- See [Sidekiq requirements][24] for detailed requirements of Sidekiq itself (be sure to check the right sidekiq version).
81
+ ## Usage
86
82
 
87
- ## Installation
83
+ ### Installation
88
84
 
89
85
  Add this line to your application's Gemfile:
90
86
 
@@ -98,16 +94,83 @@ And then execute:
98
94
  bundle
99
95
  ```
100
96
 
101
- Or install it yourself as:
97
+ ### Add the middleware
102
98
 
103
- ```bash
104
- gem install sidekiq-unique-jobs
99
+ Before v7, the middleware was configured automatically. Since some people reported issues with other gems (see [Other Sidekiq Gems](#other-sidekiq-gems)) it was decided to give full control over to the user.
100
+
101
+ *NOTE* if you want to use the reaper you also need to configure the server middleware.
102
+
103
+ [A full example](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/initializers/sidekiq.rb#L12)
104
+
105
+ ```ruby
106
+ Sidekiq.configure_server do |config|
107
+ config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }
108
+
109
+ config.client_middleware do |chain|
110
+ chain.add SidekiqUniqueJobs::Middleware::Client
111
+ end
112
+
113
+ config.server_middleware do |chain|
114
+ chain.add SidekiqUniqueJobs::Middleware::Server
115
+ end
116
+
117
+ SidekiqUniqueJobs::Server.configure(config)
118
+ end
119
+
120
+ Sidekiq.configure_client do |config|
121
+ config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }
122
+
123
+ config.client_middleware do |chain|
124
+ chain.add SidekiqUniqueJobs::Middleware::Client
125
+ end
126
+ end
105
127
  ```
106
128
 
129
+ ### Your first worker
130
+
131
+ ```ruby
132
+ # frozen_string_literal: true
133
+
134
+ class UntilExecutedWorker
135
+ include Sidekiq::Worker
136
+
137
+ sidekiq_options queue: :special,
138
+ retry: false,
139
+ lock: :until_executed,
140
+ lock_info: true,
141
+ lock_timeout: 0,
142
+ lock_prefix: "special",
143
+ lock_ttl: 0,
144
+ lock_limit: 5
145
+
146
+ def perform
147
+ logger.info("cowboy")
148
+ sleep(1) # hardcore processing
149
+ logger.info("beebop")
150
+ end
151
+ end
152
+
153
+ ```
154
+
155
+ You can read more about the worker configuration in [Worker Configuration](#worker-configuration) below.
156
+
107
157
  ## Support Me
108
158
 
109
159
  Want to show me some ❤️ for the hard work I do on this gem? You can use the following PayPal link: [https://paypal.me/mhenrixon1](https://paypal.me/mhenrixon1). Any amount is welcome and let me tell you it feels good to be appreciated. Even a dollar makes me super excited about all of this.
110
160
 
161
+ ## Requirements
162
+
163
+ - Sidekiq `>= 5.0` (`>= 5.2` recommended)
164
+ - Ruby:
165
+ - MRI `>= 2.5` (`>= 2.6` recommended)
166
+ - JRuby `>= 9.0` (`>= 9.2` recommended)
167
+ - Truffleruby
168
+ - Redis Server `>= 3.2` (`>= 5.0` recommended)
169
+ - [ActiveJob officially not supported][48]
170
+ - [redis-namespace officially not supported][49]
171
+
172
+ See [Sidekiq requirements][24] for detailed requirements of Sidekiq itself (be sure to check the right sidekiq version).
173
+
111
174
  ## General Information
112
175
 
113
176
  See [Interaction w/ Sidekiq](https://github.com/mhenrixon/sidekiq-unique-jobs/wiki/How-this-gem-interacts-with-Sidekiq) on how the gem interacts with Sidekiq.
@@ -122,16 +185,16 @@ Configure SidekiqUniqueJobs in an initializer or the sidekiq initializer on appl
122
185
 
123
186
  ```ruby
124
187
  SidekiqUniqueJobs.configure do |config|
125
- config.debug_lua = true
126
- config.lock_info = true
127
- config.lock_ttl = 10.minutes
128
- config.lock_timeout = 10.minutes
129
- config.logger = Sidekiq.logger
130
- config.max_history = 10_000
131
- config.reaper = :lua
132
- config.reaper_count = 100
133
- config.reaper_interval = 10
134
- config.reaper_timeout = 5
188
+ config.logger = Sidekiq.logger # default, change at your own discretion
189
+ config.debug_lua = false # Turn on when debugging
190
+ config.lock_info = false # Turn on when debugging
191
+ config.lock_ttl = 600 # Expire locks after 10 minutes
192
+ config.lock_timeout = nil # turn off lock timeout
193
+ config.max_history = 0 # Turn on when debugging
194
+ config.reaper = :ruby # :ruby, :lua or :none/nil
195
+ config.reaper_count = 1000 # Stop reaping after this many keys
196
+ config.reaper_interval = 600 # Reap orphans every 10 minutes
197
+ config.reaper_timeout = 150 # Timeout reaper after 1,5 minutes
135
198
  end
136
199
  ```
137
200
 
@@ -253,11 +316,27 @@ Using lock info will create an additional key for the lock with a json object co
253
316
 
254
317
  ## Worker Configuration
255
318
 
319
+ ### lock_info
320
+
321
+ Lock info gathers information about a specific lock. It collects things like which `lock_args` where used to compute the `lock_digest` that is used for maintaining uniqueness.
322
+
323
+ ```ruby
324
+ sidekiq_options lock_info: false # this is the default, set to true to turn on
325
+ ```
326
+
327
+ ### lock_prefix
328
+
329
+ Use if you want a different key prefix for the keys in redis.
330
+
331
+ ```ruby
332
+ sidekiq_options lock_prefix: "uniquejobs" # this is the default value
333
+ ```
334
+
256
335
  ### lock_ttl
257
336
 
258
337
  Lock TTL decides how long to wait after the job has been successfully processed before making it possible to reuse that lock.
259
338
 
260
- Since `v6.0.11` the other locks will expire after the server is done processing.
339
+ Starting from `v7` the expiration will take place when the job is pushed to the queue.
261
340
 
262
341
  ```ruby
263
342
  sidekiq_options lock_ttl: nil # default - don't expire keys
@@ -278,6 +357,8 @@ sidekiq_options lock_timeout: nil # lock indefinitely, this process won't contin
278
357
 
279
358
  This configuration option is slightly misleading. It doesn't disregard the queue on other jobs. Just on itself, this means that a worker that might schedule jobs into multiple queues will be able to have uniqueness enforced on all queues it is pushed to.
280
359
 
360
+ This is mainly intended for `Worker.set(queue: :another).perform_async`.
361
+
281
362
  ```ruby
282
363
  class Worker
283
364
  include Sidekiq::Worker
@@ -428,7 +509,7 @@ The last one is log which can be be used with the lock `UntilExecuted` and `Unti
428
509
  It is possible for locks to have different conflict strategy for the client and server. This is useful for `:until_and_while_executing`.
429
510
 
430
511
  ```ruby
431
- sidekiq_options lock: :until_and_while_executing,
512
+ sidekiq_options lock: :until_and_while_executing,
432
513
  on_conflict: { client: :log, server: :reject }
433
514
  ```
434
515
 
@@ -628,7 +709,7 @@ class MyWorker
628
709
  end
629
710
  ```
630
711
 
631
- Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
712
+ Starting in v5.1, Sidekiq can also fire a global callback when a job dies: In version 7, this is handled automatically for you. You don't need to add a death handler, if you configure v7 like in [Add the middleware](#add-the-middleware) you don't have to worry about the below.
632
713
 
633
714
  ```ruby
634
715
  Sidekiq.configure_server do |config|
@@ -641,10 +722,30 @@ end
641
722
 
642
723
  ### Other Sidekiq gems
643
724
 
725
+ #### apartment-sidekiq
726
+
727
+ It was reported in [#536](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/536) that the order of the Sidekiq middleware needs to be as follows.
728
+
729
+ ```ruby
730
+ Sidekiq.client_middleware do |chain|
731
+ chain.add Apartment::Sidekiq::Middleware::Client
732
+ chain.add SidekiqUniqueJobs::Middleware::Client
733
+ end
734
+
735
+ Sidekiq.server_middleware do |chain|
736
+ chain.add Apartment::Sidekiq::Middleware::Server
737
+ chain.add SidekiqUniqueJobs::Middleware::Server
738
+ end
739
+ ```
740
+
741
+ The reason being that this gem needs to be configured AFTER the apartment gem or the apartment will not be able to be considered for uniqueness
742
+
644
743
  #### sidekiq-global_id
645
744
 
646
745
  It was reported in [#235](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/235) that the order of the Sidekiq middleware needs to be as follows.
647
746
 
747
+ For a working setup check the following [file](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/sidekiq.rb#L12).
748
+
648
749
  ```ruby
649
750
  Sidekiq.client_middleware do |chain|
650
751
  chain.add Sidekiq::GlobalId::ClientMiddleware
@@ -652,12 +753,44 @@ Sidekiq.client_middleware do |chain|
652
753
  end
653
754
 
654
755
  Sidekiq.server_middleware do |chain|
655
- chain.add SidekiqUniqueJobs::Middleware::Server
656
756
  chain.add Sidekiq::GlobalId::ServerMiddleware
757
+ chain.add SidekiqUniqueJobs::Middleware::Server
758
+ end
759
+ ```
760
+
761
+ The reason for this is that the global id needs to be set before the unique jobs middleware runs. Otherwise that won't be available for uniqueness.
762
+
763
+ #### sidekiq-status
764
+
765
+ It was reported in [#564](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/564) that the order of the middleware needs to be as follows.
766
+
767
+ ```ruby
768
+ # Thanks to @ArturT for the correction
769
+
770
+ Sidekiq.configure_server do |config|
771
+ config.client_middleware do |chain|
772
+ chain.add SidekiqUniqueJobs::Middleware::Client
773
+ chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes
774
+ end
775
+
776
+ config.server_middleware do |chain|
777
+ chain.add Sidekiq::Status::ServerMiddleware, expiration: 30.minutes
778
+ chain.add SidekiqUniqueJobs::Middleware::Server
779
+ end
780
+
781
+ SidekiqUniqueJobs::Server.configure(config)
782
+ end
783
+
784
+
785
+ Sidekiq.configure_client do |config|
786
+ config.client_middleware do |chain|
787
+ chain.add SidekiqUniqueJobs::Middleware::Client
788
+ chain.add Sidekiq::Status::ClientMiddleware, expiration: 30.minutes
789
+ end
657
790
  end
658
791
  ```
659
792
 
660
- For a working setup check the following [file](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/945c4c4c517168d49e3f8ee952fcc9c430865635/myapp/config/initializers/sidekiq.rb#L8)
793
+ The reason for this is that if a job is duplicated it shouldn't end up with the status middleware at all. Status is just a monitor so to prevent clashes, leftovers and ensure cleanup. The status middleware should run after uniqueness on client and before on server. This will lead to less surprises.
661
794
 
662
795
  ## Debugging
663
796
 
@@ -728,7 +861,6 @@ If you are not using RSpec (a lot of people prefer minitest or test unit) you ca
728
861
  assert SidekiqUniqueJobs.validate_worker!(BadWorker.get_sidekiq_options)
729
862
  ```
730
863
 
731
-
732
864
  ### Uniqueness
733
865
 
734
866
  This has been probably the most confusing part of this gem. People get really confused with how unreliable the unique jobs have been. I there for decided to do what Mike is doing for sidekiq enterprise. Read the section about unique jobs: [Enterprise unique jobs][]
@@ -771,7 +903,7 @@ RSpec.describe Workers::CoolOne do
771
903
  end
772
904
  ```
773
905
 
774
- It is recommened 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:
906
+ 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:
775
907
 
776
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)
777
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)