sidekiq-unique-jobs 7.0.0.beta23 → 7.0.0.beta28

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +95 -6
  3. data/README.md +60 -35
  4. data/lib/sidekiq_unique_jobs.rb +0 -1
  5. data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
  6. data/lib/sidekiq_unique_jobs/changelog.rb +1 -1
  7. data/lib/sidekiq_unique_jobs/cli.rb +4 -2
  8. data/lib/sidekiq_unique_jobs/config.rb +2 -2
  9. data/lib/sidekiq_unique_jobs/connection.rb +1 -1
  10. data/lib/sidekiq_unique_jobs/constants.rb +5 -1
  11. data/lib/sidekiq_unique_jobs/digests.rb +1 -1
  12. data/lib/sidekiq_unique_jobs/exceptions.rb +9 -9
  13. data/lib/sidekiq_unique_jobs/job.rb +5 -5
  14. data/lib/sidekiq_unique_jobs/json.rb +1 -1
  15. data/lib/sidekiq_unique_jobs/key.rb +1 -1
  16. data/lib/sidekiq_unique_jobs/lock.rb +1 -1
  17. data/lib/sidekiq_unique_jobs/lock/base_lock.rb +1 -1
  18. data/lib/sidekiq_unique_jobs/lock/client_validator.rb +1 -1
  19. data/lib/sidekiq_unique_jobs/lock/server_validator.rb +1 -1
  20. data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +1 -1
  21. data/lib/sidekiq_unique_jobs/lock/until_executed.rb +1 -1
  22. data/lib/sidekiq_unique_jobs/lock/until_executing.rb +1 -1
  23. data/lib/sidekiq_unique_jobs/lock/until_expired.rb +1 -1
  24. data/lib/sidekiq_unique_jobs/lock/validator.rb +3 -2
  25. data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -2
  26. data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +1 -1
  27. data/lib/sidekiq_unique_jobs/lock_args.rb +4 -4
  28. data/lib/sidekiq_unique_jobs/lock_config.rb +5 -5
  29. data/lib/sidekiq_unique_jobs/lock_digest.rb +2 -2
  30. data/lib/sidekiq_unique_jobs/lock_info.rb +1 -1
  31. data/lib/sidekiq_unique_jobs/lock_timeout.rb +1 -1
  32. data/lib/sidekiq_unique_jobs/lock_ttl.rb +1 -1
  33. data/lib/sidekiq_unique_jobs/locksmith.rb +2 -2
  34. data/lib/sidekiq_unique_jobs/logging.rb +3 -3
  35. data/lib/sidekiq_unique_jobs/logging/middleware_context.rb +2 -2
  36. data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +1 -1
  37. data/lib/sidekiq_unique_jobs/middleware.rb +16 -4
  38. data/lib/sidekiq_unique_jobs/middleware/client.rb +5 -5
  39. data/lib/sidekiq_unique_jobs/middleware/server.rb +3 -3
  40. data/lib/sidekiq_unique_jobs/normalizer.rb +1 -1
  41. data/lib/sidekiq_unique_jobs/on_conflict.rb +1 -1
  42. data/lib/sidekiq_unique_jobs/on_conflict/log.rb +1 -1
  43. data/lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb +1 -1
  44. data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +1 -1
  45. data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +1 -1
  46. data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +1 -1
  47. data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +1 -1
  48. data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +1 -1
  49. data/lib/sidekiq_unique_jobs/options_with_fallback.rb +1 -1
  50. data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +1 -1
  51. data/lib/sidekiq_unique_jobs/orphans/manager.rb +35 -4
  52. data/lib/sidekiq_unique_jobs/orphans/null_reaper.rb +24 -0
  53. data/lib/sidekiq_unique_jobs/orphans/observer.rb +2 -2
  54. data/lib/sidekiq_unique_jobs/orphans/reaper.rb +5 -1
  55. data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +6 -6
  56. data/lib/sidekiq_unique_jobs/profiler.rb +1 -1
  57. data/lib/sidekiq_unique_jobs/redis.rb +1 -1
  58. data/lib/sidekiq_unique_jobs/redis/entity.rb +1 -1
  59. data/lib/sidekiq_unique_jobs/redis/hash.rb +1 -1
  60. data/lib/sidekiq_unique_jobs/redis/list.rb +1 -1
  61. data/lib/sidekiq_unique_jobs/redis/set.rb +1 -1
  62. data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +1 -1
  63. data/lib/sidekiq_unique_jobs/redis/string.rb +1 -1
  64. data/lib/sidekiq_unique_jobs/rspec/matchers.rb +2 -2
  65. data/lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb +2 -2
  66. data/lib/sidekiq_unique_jobs/script.rb +1 -1
  67. data/lib/sidekiq_unique_jobs/script/caller.rb +2 -2
  68. data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +5 -5
  69. data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +2 -2
  70. data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +9 -3
  71. data/lib/sidekiq_unique_jobs/testing.rb +2 -1
  72. data/lib/sidekiq_unique_jobs/timing.rb +1 -1
  73. data/lib/sidekiq_unique_jobs/unlockable.rb +1 -1
  74. data/lib/sidekiq_unique_jobs/update_version.rb +1 -1
  75. data/lib/sidekiq_unique_jobs/upgrade_locks.rb +1 -1
  76. data/lib/sidekiq_unique_jobs/version.rb +1 -1
  77. data/lib/sidekiq_unique_jobs/version_check.rb +23 -4
  78. data/lib/sidekiq_unique_jobs/web.rb +1 -1
  79. data/lib/sidekiq_unique_jobs/web/helpers.rb +1 -1
  80. metadata +19 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85f40cdbdf1f6652712a0a5ef535a58cb4831a871b0defa73b5b32db54bb8a02
4
- data.tar.gz: 4ed0cc541f98f80f6875d6e47b077494d623f72d40392e201977d0510b0cb18b
3
+ metadata.gz: 13bc0a51e575fe6e019fa0e47b16875733eaf3c674913caff86c8e9e25b03212
4
+ data.tar.gz: 4798530068d809e896baf5a5091eb81f31f72adec762232e606c3b9c59946889
5
5
  SHA512:
6
- metadata.gz: b6a43eb07c5bc25ae1b40a521f56280eb37dec346ada147d07f1eae5a125bc4e29455548987796d52ab8bea16c7587c4a5e08a57dfa9cfb4fba47b0d2f152799
7
- data.tar.gz: 998560f4beadb2d2e3012b44d5f1d792e1b42ba18881f3f6b699d8486ad5593923469d755eb473c023d107c311014e51b1400ed772f5138ba4010104ba29c88d
6
+ metadata.gz: aad36721efc247b274437dbc327d21bf4c014d482962ce361cad6a7b2fbf63874d32121ac4f2f44d14197169c7c8ac9bb268b7ad8851d2cf407e9c47503524ce
7
+ data.tar.gz: b1308b72466f8a7ec8150e0997eab097c17fcabd7d554811e0ddd3ff547105ff9fa36442318bd9db182a3b6b130e755f6ac4fce93d863cb6c60ae3fe4cadf5c2
@@ -2,11 +2,100 @@
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.0.beta22...HEAD)
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta27...HEAD)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - 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)
10
+
11
+ ## [v7.0.0.beta27](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta27) (2020-11-03)
12
+
13
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta26...v7.0.0.beta27)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - Adds coverage for regression purposes [\#550](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/550) ([mhenrixon](https://github.com/mhenrixon))
18
+
19
+ **Fixed bugs:**
20
+
21
+ - Rename lock\_args to lock\_args\_method [\#551](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/551) ([mhenrixon](https://github.com/mhenrixon))
22
+
23
+ **Closed issues:**
24
+
25
+ - Documentation incorrect for `delete\_by\_digest` [\#547](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/547)
26
+ - Locked jobs after kill -9 with while\_executing lock [\#546](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/546)
27
+
28
+ ## [v7.0.0.beta26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta26) (2020-10-28)
29
+
30
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...v7.0.0.beta26)
31
+
32
+ **Implemented enhancements:**
33
+
34
+ - How to disable Reaper [\#543](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/543)
35
+ - Allow disabling of reaper [\#544](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/544) ([mhenrixon](https://github.com/mhenrixon))
36
+
37
+ **Merged pull requests:**
38
+
39
+ - Update sidekiq-unique-jobs.gemspec [\#542](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/542) ([sergey-alekseev](https://github.com/sergey-alekseev))
40
+
41
+ ## [v6.0.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.25) (2020-10-26)
42
+
43
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta25...v6.0.25)
44
+
45
+ **Implemented enhancements:**
46
+
47
+ - Support apartment [\#541](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/541) ([mhenrixon](https://github.com/mhenrixon))
48
+ - Support both instance method and class method [\#528](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/528) ([mhenrixon](https://github.com/mhenrixon))
49
+
50
+ ## [v7.0.0.beta25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta25) (2020-10-26)
51
+
52
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
53
+
54
+ **Implemented enhancements:**
55
+
56
+ - Bump rubocop [\#539](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/539) ([mhenrixon](https://github.com/mhenrixon))
57
+
58
+ **Fixed bugs:**
59
+
60
+ - 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
+
63
+ **Closed issues:**
64
+
65
+ - ConnectionPool::TimeoutError and :until\_executed [\#535](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/535)
66
+
67
+ **Merged pull requests:**
68
+
69
+ - Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
70
+
71
+ ## [v7.0.0.beta24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta24) (2020-09-27)
72
+
73
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta23...v7.0.0.beta24)
74
+
75
+ **Implemented enhancements:**
76
+
77
+ - Support both instance method and class method [\#527](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/527) ([mhenrixon](https://github.com/mhenrixon))
6
78
 
7
79
  **Closed issues:**
8
80
 
81
+ - Leaked keys in version 5.0.10 [\#519](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/519)
82
+
83
+ ## [v7.0.0.beta23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta23) (2020-06-23)
84
+
85
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.23...v7.0.0.beta23)
86
+
87
+ **Fixed bugs:**
88
+
89
+ - Exit early when no results are returned from LRANGE given jobs might already processed [\#521](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/521) ([vipulnsward](https://github.com/vipulnsward))
90
+
91
+ ## [v6.0.23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.23) (2020-06-23)
92
+
93
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta22...v6.0.23)
94
+
95
+ **Fixed bugs:**
96
+
9
97
  - Ruby reaper incorrectly checks active jobs — removes every active lock as result [\#517](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/517)
98
+ - Backport \#465 to 6.x series [\#520](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/520) ([replaid](https://github.com/replaid))
10
99
 
11
100
  ## [v7.0.0.beta22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta22) (2020-06-12)
12
101
 
@@ -417,7 +506,7 @@
417
506
  **Closed issues:**
418
507
 
419
508
  - Unique args in combination with sidekiq cron contains `\_aj\_symbol\_keys` [\#363](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/363)
420
- - Low quality peace of shit [\#360](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/360)
509
+ - Low quality piece of shit [\#360](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/360)
421
510
  - Passthrough has been deprecated and will be removed in redis-namespace 2.0 [\#338](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/338)
422
511
 
423
512
  ## [v6.0.12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.12) (2019-02-28)
@@ -695,6 +784,7 @@
695
784
  **Implemented enhancements:**
696
785
 
697
786
  - Prepare for v6 [\#286](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/286) ([mhenrixon](https://github.com/mhenrixon))
787
+ - Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
698
788
 
699
789
  ## [v6.0.0.rc3](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc3) (2018-06-29)
700
790
 
@@ -712,7 +802,6 @@
712
802
 
713
803
  - Within tests: workers enqueued in the future don't clear their unique locks after being drained/executed [\#254](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/254)
714
804
  - Unexpected behavior with until\_executed [\#250](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/250)
715
- - Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
716
805
 
717
806
  **Fixed bugs:**
718
807
 
@@ -762,7 +851,6 @@
762
851
  - Code smells [\#275](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/275) ([mhenrixon](https://github.com/mhenrixon))
763
852
  - Reject while scheduling [\#273](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/273) ([mhenrixon](https://github.com/mhenrixon))
764
853
  - Improve testing [\#272](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/272) ([mhenrixon](https://github.com/mhenrixon))
765
- - Solidify master [\#270](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/270) ([mhenrixon](https://github.com/mhenrixon))
766
854
 
767
855
  ## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
768
856
 
@@ -771,6 +859,7 @@
771
859
  **Implemented enhancements:**
772
860
 
773
861
  - Until and while executing [\#271](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/271) ([mhenrixon](https://github.com/mhenrixon))
862
+ - Solidify master [\#270](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/270) ([mhenrixon](https://github.com/mhenrixon))
774
863
  - Minor adjustments [\#268](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/268) ([mhenrixon](https://github.com/mhenrixon))
775
864
  - Use ruby 2.5.1 [\#267](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/267) ([mhenrixon](https://github.com/mhenrixon))
776
865
  - Add explicit concurrent-ruby dependency. [\#265](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/265) ([brettburley](https://github.com/brettburley))
@@ -931,7 +1020,6 @@
931
1020
  - Increase sleep delay in WhileExecuting\#synchronize [\#204](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/204) ([dsander](https://github.com/dsander))
932
1021
  - Ensure job ID removed from uniquejobs hash [\#200](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/200) ([carlosmartinez](https://github.com/carlosmartinez))
933
1022
  - unique args need to be an array [\#194](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/194) ([pboling](https://github.com/pboling))
934
- - fix for \#168. Handle the NOSCRIPT by sending the script again [\#178](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/178) ([otzy007](https://github.com/otzy007))
935
1023
 
936
1024
  ## [v4.0.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18) (2016-07-24)
937
1025
 
@@ -954,6 +1042,7 @@
954
1042
 
955
1043
  - missed space [\#188](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/188) ([TheBigSadowski](https://github.com/TheBigSadowski))
956
1044
  - Convert unless if to just 1 if [\#179](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/179) ([otzy007](https://github.com/otzy007))
1045
+ - fix for \#168. Handle the NOSCRIPT by sending the script again [\#178](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/178) ([otzy007](https://github.com/otzy007))
957
1046
  - Fixed gitter badge link [\#176](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/176) ([andrew](https://github.com/andrew))
958
1047
 
959
1048
  ## [v4.0.17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.17) (2016-03-02)
@@ -1055,6 +1144,7 @@
1055
1144
  **Merged pull requests:**
1056
1145
 
1057
1146
  - Calculate worker's unique args when a proc or a symbol is specified [\#143](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/143) ([zeqfreed](https://github.com/zeqfreed))
1147
+ - Fix markdown link formatting [\#134](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/134) ([thbar](https://github.com/thbar))
1058
1148
 
1059
1149
  ## [v4.0.7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.7) (2015-10-14)
1060
1150
 
@@ -1085,7 +1175,6 @@
1085
1175
 
1086
1176
  **Merged pull requests:**
1087
1177
 
1088
- - Fix markdown link formatting [\#134](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/134) ([thbar](https://github.com/thbar))
1089
1178
  - Forces to look for testing namespace in Sidekiq and not his ancestors [\#129](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/129) ([antek-drzewiecki](https://github.com/antek-drzewiecki))
1090
1179
  - Fix outdated phrasing and add test coverage to readme [\#123](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/123) ([albertyw](https://github.com/albertyw))
1091
1180
 
data/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  - [reaper_count](#reaper_count)
19
19
  - [reaper_interval](#reaper_interval)
20
20
  - [reaper_timeout](#reaper_timeout)
21
- - [unique_prefix](#unique_prefix)
21
+ - [lock_prefix](#lock_prefix)
22
22
  - [lock_info](#lock_info)
23
23
  - [Worker Configuration](#worker-configuration)
24
24
  - [lock_ttl](#lock_ttl-1)
@@ -33,15 +33,27 @@
33
33
  - [While Executing](#while-executing)
34
34
  - [Custom Locks](#custom-locks)
35
35
  - [Conflict Strategy](#conflict-strategy)
36
- - [lib/strategies/my_custom_strategy.rb](#libstrategiesmy_custom_strategyrb)
37
- - [For rails application](#for-rails-application)
38
- - [config/initializers/sidekiq_unique_jobs.rb](#configinitializerssidekiq_unique_jobsrb)
39
- - [For other projects, whenever you prefer](#for-other-projects-whenever-you-prefer)
40
- - [this goes in your initializer](#this-goes-in-your-initializer)
41
- - [app/config/routes.rb](#appconfigroutesrb)
42
- - [app/workers/bad_worker.rb](#appworkersbad_workerrb)
43
- - [spec/workers/bad_worker_spec.rb](#specworkersbad_worker_specrb)
44
- - [OR](#or)
36
+ - [log](#log)
37
+ - [raise](#raise)
38
+ - [reject](#reject)
39
+ - [replace](#replace)
40
+ - [Reschedule](#reschedule)
41
+ - [Custom Strategies](#custom-strategies)
42
+ - [Usage](#usage)
43
+ - [Finer Control over Uniqueness](#finer-control-over-uniqueness)
44
+ - [After Unlock Callback](#after-unlock-callback)
45
+ - [Logging](#logging)
46
+ - [Cleanup Dead Locks](#cleanup-dead-locks)
47
+ - [Other Sidekiq gems](#other-sidekiq-gems)
48
+ - [sidekiq-global_id](#sidekiq-global_id)
49
+ - [Debugging](#debugging)
50
+ - [Sidekiq Web](#sidekiq-web)
51
+ - [Show Locks](#show-locks)
52
+ - [Show Lock](#show-lock)
53
+ - [Communication](#communication)
54
+ - [Testing](#testing)
55
+ - [Unique Sidekiq Configuration](#unique-sidekiq-configuration)
56
+ - [Uniqueness](#uniqueness)
45
57
  - [Contributing](#contributing)
46
58
  - [Contributors](#contributors)
47
59
 
@@ -49,13 +61,13 @@
49
61
 
50
62
  ## Introduction
51
63
 
52
- The goal of this gem is to ensure your Sidekiq jobs are unique. We do this by creating unique keys in Redis based on how you configure uniqueness.
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.
53
65
 
54
66
  This is the documentation for the master branch. You can find the documentation for each release by navigating to its tag.
55
67
 
56
68
  Here are links to some of the old versions
57
69
 
58
- - [v6.0.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.13)
70
+ - [v6.0.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.25)
59
71
  - [v5.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10)
60
72
  - [v4.0.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18)
61
73
 
@@ -106,6 +118,8 @@ See [Locking & Unlocking](https://github.com/mhenrixon/sidekiq-unique-jobs/wiki/
106
118
 
107
119
  The gem supports a few different configuration options that might be of interest if you run into some weird issues.
108
120
 
121
+ Configure SidekiqUniqueJobs in an initializer or the sidekiq initializer on application startup.
122
+
109
123
  ```ruby
110
124
  SidekiqUniqueJobs.configure do |config|
111
125
  config.debug_lua = true
@@ -189,6 +203,14 @@ On the other hand if I increase it to 10 000 orphaned locks per cleanup (`reaper
189
203
 
190
204
  > BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE. (Redis::CommandError)
191
205
 
206
+ If you want to disable the reaper set it to `:none`, `nil` or `false`. Actually, any value that isn't `:ruby` or `:lua` will disable the reaping.
207
+
208
+ ```ruby
209
+ SidekiqUniqueJobs.config.reaper = :none
210
+ SidekiqUniqueJobs.config.reaper = nil
211
+ SidekiqUniqueJobs.config.reaper = false
212
+ ```
213
+
192
214
  ### reaper_count
193
215
 
194
216
  ```ruby
@@ -213,10 +235,10 @@ SidekiqUniqueJobs.config.reaper_timeout #=> 10
213
235
 
214
236
  The number of seconds to wait for the reaper to finish before raising a TimeoutError. This is done to ensure that the next time we reap isn't getting stuck due to the previous process already running.
215
237
 
216
- ### unique_prefix
238
+ ### lock_prefix
217
239
 
218
240
  ```ruby
219
- SidekiqUniqueJobs.config.unique_prefix #=> "uniquejobs"
241
+ SidekiqUniqueJobs.config.lock_prefix #=> "uniquejobs"
220
242
  ```
221
243
 
222
244
  Use if you want a different key prefix for the keys in redis.
@@ -383,11 +405,9 @@ You can refer on all the locks defined in `lib/sidekiq_unique_jobs/lock/*.rb`.
383
405
 
384
406
  In order to make it available, you should call in your project startup:
385
407
 
386
- ```ruby
387
- # For rails application
388
- # config/initializers/sidekiq_unique_jobs.rb
389
- # For other projects, whenever you prefer
408
+ (For rails application config/initializers/sidekiq_unique_jobs.rb or other projects, wherever you prefer)
390
409
 
410
+ ```ruby
391
411
  SidekiqUniqueJobs.configure do |config|
392
412
  config.add_lock :my_custom_lock, Locks::MyCustomLock
393
413
  end
@@ -408,7 +428,9 @@ The last one is log which can be be used with the lock `UntilExecuted` and `Unti
408
428
  It is possible for locks to have different conflict strategy for the client and server. This is useful for `:until_and_while_executing`.
409
429
 
410
430
  ```ruby
411
- sidekiq_options lock: :until_and_while_executing, on_conflict: { client: :log, server: :reject }
431
+ sidekiq_options lock: :until_and_while_executing,
432
+ on_conflict: { client: :log, server: :reject }
433
+ ```
412
434
 
413
435
  ### log
414
436
 
@@ -474,11 +496,9 @@ You can refer to all the strategies defined in `lib/sidekiq_unique_jobs/on_confl
474
496
 
475
497
  In order to make it available, you should call in your project startup:
476
498
 
477
- ```ruby
478
- # For rails application
479
- # config/initializers/sidekiq_unique_jobs.rb
480
- # For other projects, whenever you prefer
499
+ (For rails application config/initializers/sidekiq_unique_jobs.rb for other projects, wherever you prefer)
481
500
 
501
+ ```ruby
482
502
  SidekiqUniqueJobs.configure do |config|
483
503
  config.add_strategy :my_custom_strategy, Strategies::MyCustomStrategy
484
504
  end
@@ -516,7 +536,7 @@ The method or the proc can return a modified version of args without the transie
516
536
  class UniqueJobWithFilterMethod
517
537
  include Sidekiq::Worker
518
538
  sidekiq_options lock: :until_and_while_executing,
519
- lock_args: :lock_args # this is default and will be used if such a method is defined
539
+ lock_args_method: :lock_args # this is default and will be used if such a method is defined
520
540
 
521
541
  def self.lock_args(args)
522
542
  [ args[0], args[2][:type] ]
@@ -529,7 +549,7 @@ end
529
549
  class UniqueJobWithFilterProc
530
550
  include Sidekiq::Worker
531
551
  sidekiq_options lock: :until_executed,
532
- lock_args: ->(args) { [ args.first ] }
552
+ lock_args_method: ->(args) { [ args.first ] }
533
553
 
534
554
  ...
535
555
 
@@ -541,7 +561,7 @@ It is possible to ensure different types of unique args based on context. I can'
541
561
  ```ruby
542
562
  class UniqueJobWithFilterMethod
543
563
  include Sidekiq::Worker
544
- sidekiq_options lock: :until_and_while_executing, lock_args: :lock_args
564
+ sidekiq_options lock: :until_and_while_executing, lock_args_method: :lock_args
545
565
 
546
566
  def self.lock_args(args)
547
567
  if Sidekiq::ProcessSet.new.size > 1
@@ -562,11 +582,17 @@ If you need to perform any additional work after the lock has been released you
562
582
  **Exception 1:** UntilExecuting unlocks and uses callback before yielding.
563
583
  **Exception 2:** UntilExpired expires eventually, no after_unlock hook is called.
564
584
 
585
+ **NOTE:** _It is also possible to write this code as a class method._
586
+
565
587
  ```ruby
566
588
  class UniqueJobWithFilterMethod
567
589
  include Sidekiq::Worker
568
590
  sidekiq_options lock: :while_executing,
569
591
 
592
+ def self.after_unlock
593
+ # block has yielded and lock is released
594
+ end
595
+
570
596
  def after_unlock
571
597
  # block has yielded and lock is released
572
598
  end
@@ -596,8 +622,8 @@ For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required
596
622
  ```ruby
597
623
  class MyWorker
598
624
  sidekiq_retries_exhausted do |msg, _ex|
599
- digest = msg['unique_digest']
600
- SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
625
+ digest = msg['lock_digest']
626
+ SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
601
627
  end
602
628
  end
603
629
  ```
@@ -605,11 +631,10 @@ end
605
631
  Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
606
632
 
607
633
  ```ruby
608
- # this goes in your initializer
609
634
  Sidekiq.configure_server do |config|
610
635
  config.death_handlers << ->(job, _ex) do
611
- digest = job['unique_digest']
612
- SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
636
+ digest = job['lock_digest']
637
+ SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
613
638
  end
614
639
  end
615
640
  ```
@@ -643,7 +668,7 @@ There are several ways of removing keys that are stuck. The prefered way is by u
643
668
  To use the web extension you need to require it in your routes.
644
669
 
645
670
  ```ruby
646
- # app/config/routes.rb
671
+ #app/config/routes.rb
647
672
  require 'sidekiq_unique_jobs/web'
648
673
  mount Sidekiq::Web, at: '/sidekiq'
649
674
  ```
@@ -674,15 +699,15 @@ Since v7 it is possible to perform some simple validation against your workers s
674
699
  Let's take a _bad_ worker:
675
700
 
676
701
  ```ruby
677
- # app/workers/bad_worker.rb
702
+ #app/workers/bad_worker.rb
678
703
  class BadWorker
679
704
  sidekiq_options lock: :while_executing, on_conflict: :replace
680
705
  end
681
706
 
682
- # spec/workers/bad_worker_spec.rb
707
+ #spec/workers/bad_worker_spec.rb
683
708
 
684
709
  require "sidekiq_unique_jobs/testing"
685
- # OR
710
+ #OR
686
711
  require "sidekiq_unique_jobs/rspec/matchers"
687
712
 
688
713
  RSpec.describe BadWorker do
@@ -26,7 +26,6 @@ require "sidekiq_unique_jobs/connection"
26
26
  require "sidekiq_unique_jobs/exceptions"
27
27
  require "sidekiq_unique_jobs/script"
28
28
  require "sidekiq_unique_jobs/script/caller"
29
- require "sidekiq_unique_jobs/json"
30
29
  require "sidekiq_unique_jobs/normalizer"
31
30
  require "sidekiq_unique_jobs/job"
32
31
  require "sidekiq_unique_jobs/redis"
@@ -4,7 +4,7 @@ module SidekiqUniqueJobs
4
4
  #
5
5
  # Class BatchDelete provides batch deletion of digests
6
6
  #
7
- # @author Mikael Henriksson <mikael@zoolutions.se>
7
+ # @author Mikael Henriksson <mikael@mhenrixon.com>
8
8
  #
9
9
  class BatchDelete
10
10
  #
@@ -4,7 +4,7 @@ module SidekiqUniqueJobs
4
4
  #
5
5
  # Class Changelogs provides access to the changelog entries
6
6
  #
7
- # @author Mikael Henriksson <mikael@zoolutions.se>
7
+ # @author Mikael Henriksson <mikael@mhenrixon.com>
8
8
  #
9
9
  class Changelog < Redis::SortedSet
10
10
  def initialize
@@ -6,13 +6,15 @@ module SidekiqUniqueJobs
6
6
  #
7
7
  # Command line interface for unique jobs
8
8
  #
9
- # @author Mikael Henriksson <mikael@zoolutions.se>
9
+ # @author Mikael Henriksson <mikael@mhenrixon.com>
10
10
  #
11
11
  class Cli < Thor
12
12
  # :nodoc:
13
- def self.banner(command, _namespace = nil, _subcommand = false)
13
+ # rubocop:disable Style/OptionalBooleanParameter
14
+ def self.banner(command, _namespace = nil, _subcommand = false) # rubocop:disable Style/OptionalBooleanParameter
14
15
  "jobs #{@package_name} #{command.usage}" # rubocop:disable ThreadSafety/InstanceVariableInClassMethod
15
16
  end
17
+ # rubocop:enable Style/OptionalBooleanParameter
16
18
 
17
19
  desc "list PATTERN", "list all unique digests and their expiry time"
18
20
  option :count, aliases: :c, type: :numeric, default: 1000, desc: "The max number of digests to return"