sidekiq-unique-jobs 7.0.0.beta25 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq-unique-jobs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +99 -15
- data/README.md +192 -55
- data/lib/sidekiq-unique-jobs.rb +0 -2
- data/lib/sidekiq_unique_jobs/batch_delete.rb +1 -1
- data/lib/sidekiq_unique_jobs/changelog.rb +2 -2
- data/lib/sidekiq_unique_jobs/cli.rb +1 -1
- data/lib/sidekiq_unique_jobs/config.rb +2 -2
- data/lib/sidekiq_unique_jobs/connection.rb +1 -1
- data/lib/sidekiq_unique_jobs/constants.rb +5 -1
- data/lib/sidekiq_unique_jobs/digests.rb +2 -2
- data/lib/sidekiq_unique_jobs/exceptions.rb +9 -9
- data/lib/sidekiq_unique_jobs/job.rb +2 -2
- data/lib/sidekiq_unique_jobs/json.rb +1 -1
- data/lib/sidekiq_unique_jobs/key.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/base_lock.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/client_validator.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/server_validator.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_executed.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_executing.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/until_expired.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock/validator.rb +3 -2
- data/lib/sidekiq_unique_jobs/lock/while_executing.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock/while_executing_reject.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_args.rb +5 -5
- data/lib/sidekiq_unique_jobs/lock_config.rb +3 -1
- data/lib/sidekiq_unique_jobs/lock_digest.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_info.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +1 -1
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +1 -1
- data/lib/sidekiq_unique_jobs/locksmith.rb +2 -2
- data/lib/sidekiq_unique_jobs/logging.rb +1 -1
- data/lib/sidekiq_unique_jobs/logging/middleware_context.rb +2 -2
- data/lib/sidekiq_unique_jobs/lua/delete_by_digest.lua +1 -1
- data/lib/sidekiq_unique_jobs/lua/lock.lua +1 -2
- data/lib/sidekiq_unique_jobs/lua/reap_orphans.lua +8 -7
- data/lib/sidekiq_unique_jobs/lua/shared/_find_digest_in_process_set.lua +9 -2
- data/lib/sidekiq_unique_jobs/middleware.rb +1 -58
- data/lib/sidekiq_unique_jobs/middleware/client.rb +1 -1
- data/lib/sidekiq_unique_jobs/middleware/server.rb +1 -1
- data/lib/sidekiq_unique_jobs/normalizer.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/log.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/raise.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/replace.rb +10 -9
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +2 -2
- data/lib/sidekiq_unique_jobs/on_conflict/strategy.rb +1 -1
- data/lib/sidekiq_unique_jobs/options_with_fallback.rb +1 -1
- data/lib/sidekiq_unique_jobs/orphans/lua_reaper.rb +2 -2
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +41 -5
- data/lib/sidekiq_unique_jobs/orphans/null_reaper.rb +24 -0
- data/lib/sidekiq_unique_jobs/orphans/observer.rb +2 -2
- data/lib/sidekiq_unique_jobs/orphans/reaper.rb +15 -1
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +10 -3
- data/lib/sidekiq_unique_jobs/redis.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/entity.rb +10 -4
- data/lib/sidekiq_unique_jobs/redis/hash.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/list.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/set.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/sorted_set.rb +1 -1
- data/lib/sidekiq_unique_jobs/redis/string.rb +1 -1
- data/lib/sidekiq_unique_jobs/rspec/matchers.rb +2 -2
- data/lib/sidekiq_unique_jobs/rspec/matchers/have_valid_sidekiq_options.rb +2 -2
- data/lib/sidekiq_unique_jobs/script.rb +1 -1
- data/lib/sidekiq_unique_jobs/script/caller.rb +2 -2
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +5 -5
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +2 -2
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +2 -2
- data/lib/sidekiq_unique_jobs/testing.rb +2 -1
- data/lib/sidekiq_unique_jobs/timing.rb +1 -1
- data/lib/sidekiq_unique_jobs/unlockable.rb +1 -1
- data/lib/sidekiq_unique_jobs/update_version.rb +1 -1
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +1 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/version_check.rb +1 -1
- data/lib/sidekiq_unique_jobs/web.rb +8 -9
- data/lib/sidekiq_unique_jobs/web/helpers.rb +1 -1
- metadata +26 -11
- data/lib/sidekiq_unique_jobs/profiler.rb +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a0ef0c8257f0c79b137bab502492428dcbd9060b44d1b1fa754e5c591ef9185
|
4
|
+
data.tar.gz: '03380b590a1e077f429e2b9bce284716b6f6d891cf35a1eeb7c01e82b2b23782'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7c5881985fd2b2d96a2af3ad29e39e56a1df353b888e0a10720d4bee03cebeafee05e327b5fe54f809b0a1e567f0466e5754bee4e5e0179d14ce232a39a1e8b
|
7
|
+
data.tar.gz: 4fa3667cb51c5b44791b10f3672dbebd5f3733adae80b512775629a29d3feed4e67c5df8ce20993fa89d4810a6ca9aef7c0922e1f03bd305e0421679316ba3f9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,90 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.0.0.beta29](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta29) (2021-01-16)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta28...v7.0.0.beta29)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Ruby Reaper active check incorrect [\#557](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/557)
|
10
|
+
- Routes with authentication should work with web [\#562](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/562) ([mhenrixon](https://github.com/mhenrixon))
|
11
|
+
|
12
|
+
**Closed issues:**
|
13
|
+
|
14
|
+
- 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)
|
15
|
+
|
16
|
+
## [v7.0.0.beta28](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta28) (2021-01-07)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta27...v7.0.0.beta28)
|
19
|
+
|
20
|
+
**Fixed bugs:**
|
21
|
+
|
22
|
+
- 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)
|
23
|
+
- incorrect `:while\_executing` behavior [\#432](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/432)
|
24
|
+
- Fix active check for the worker hash [\#558](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/558) ([mhenrixon](https://github.com/mhenrixon))
|
25
|
+
- Prefer lock\_prefix not unique\_prefix [\#554](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/554) ([mhenrixon](https://github.com/mhenrixon))
|
26
|
+
- Fix issue 432 [\#552](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/552) ([mhenrixon](https://github.com/mhenrixon))
|
27
|
+
|
28
|
+
## [v7.0.0.beta27](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta27) (2020-11-03)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta26...v7.0.0.beta27)
|
31
|
+
|
32
|
+
**Implemented enhancements:**
|
33
|
+
|
34
|
+
- Adds coverage for regression purposes [\#550](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/550) ([mhenrixon](https://github.com/mhenrixon))
|
35
|
+
|
36
|
+
**Fixed bugs:**
|
37
|
+
|
38
|
+
- Rename lock\_args to lock\_args\_method [\#551](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/551) ([mhenrixon](https://github.com/mhenrixon))
|
39
|
+
|
40
|
+
**Closed issues:**
|
41
|
+
|
42
|
+
- Documentation incorrect for `delete\_by\_digest` [\#547](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/547)
|
43
|
+
- Locked jobs after kill -9 with while\_executing lock [\#546](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/546)
|
44
|
+
|
45
|
+
## [v7.0.0.beta26](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta26) (2020-10-28)
|
46
|
+
|
47
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.25...v7.0.0.beta26)
|
48
|
+
|
49
|
+
**Implemented enhancements:**
|
50
|
+
|
51
|
+
- How to disable Reaper [\#543](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/543)
|
52
|
+
- Allow disabling of reaper [\#544](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/544) ([mhenrixon](https://github.com/mhenrixon))
|
53
|
+
|
54
|
+
**Merged pull requests:**
|
55
|
+
|
56
|
+
- Update sidekiq-unique-jobs.gemspec [\#542](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/542) ([sergey-alekseev](https://github.com/sergey-alekseev))
|
57
|
+
|
58
|
+
## [v6.0.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.25) (2020-10-26)
|
59
|
+
|
60
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta25...v6.0.25)
|
61
|
+
|
62
|
+
**Implemented enhancements:**
|
63
|
+
|
64
|
+
- Support apartment [\#541](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/541) ([mhenrixon](https://github.com/mhenrixon))
|
65
|
+
- Support both instance method and class method [\#528](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/528) ([mhenrixon](https://github.com/mhenrixon))
|
66
|
+
|
67
|
+
## [v7.0.0.beta25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta25) (2020-10-26)
|
68
|
+
|
69
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta24...v7.0.0.beta25)
|
70
|
+
|
71
|
+
**Implemented enhancements:**
|
72
|
+
|
73
|
+
- Bump rubocop [\#539](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/539) ([mhenrixon](https://github.com/mhenrixon))
|
74
|
+
|
75
|
+
**Fixed bugs:**
|
76
|
+
|
77
|
+
- Ruby reaper not working, active jobs queried incorrectly [\#537](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/537)
|
78
|
+
- Fix RubyReaper active? [\#538](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/538) ([tanner-rutgers](https://github.com/tanner-rutgers))
|
79
|
+
|
80
|
+
**Closed issues:**
|
81
|
+
|
82
|
+
- ConnectionPool::TimeoutError and :until\_executed [\#535](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/535)
|
83
|
+
|
84
|
+
**Merged pull requests:**
|
85
|
+
|
86
|
+
- Support apartment [\#540](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/540) ([mhenrixon](https://github.com/mhenrixon))
|
87
|
+
|
3
88
|
## [v7.0.0.beta24](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta24) (2020-09-27)
|
4
89
|
|
5
90
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta23...v7.0.0.beta24)
|
@@ -10,7 +95,6 @@
|
|
10
95
|
|
11
96
|
**Closed issues:**
|
12
97
|
|
13
|
-
- while\_executing + raise let non-unique jobs to be executed [\#534](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/534)
|
14
98
|
- Leaked keys in version 5.0.10 [\#519](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/519)
|
15
99
|
|
16
100
|
## [v7.0.0.beta23](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta23) (2020-06-23)
|
@@ -190,10 +274,6 @@
|
|
190
274
|
|
191
275
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta10...v7.0.0.beta11)
|
192
276
|
|
193
|
-
**Fixed bugs:**
|
194
|
-
|
195
|
-
- Only configure RSpec when constant is defined [\#477](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/477) ([mhenrixon](https://github.com/mhenrixon))
|
196
|
-
|
197
277
|
## [v7.0.0.beta10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta10) (2020-03-21)
|
198
278
|
|
199
279
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.19...v7.0.0.beta10)
|
@@ -208,6 +288,7 @@
|
|
208
288
|
**Fixed bugs:**
|
209
289
|
|
210
290
|
- With v6.0.18, Sidekiq doesn't run at all [\#471](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/471)
|
291
|
+
- Only configure RSpec when constant is defined [\#477](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/477) ([mhenrixon](https://github.com/mhenrixon))
|
211
292
|
- Fix errors\_as\_string on lock\_config.rb [\#469](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/469) ([donaldpiret](https://github.com/donaldpiret))
|
212
293
|
|
213
294
|
**Merged pull requests:**
|
@@ -347,7 +428,6 @@
|
|
347
428
|
**Fixed bugs:**
|
348
429
|
|
349
430
|
- Redis is busy running script and script never terminates [\#441](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/441)
|
350
|
-
- Make the ruby reaper plain ruby [\#443](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/443) ([mhenrixon](https://github.com/mhenrixon))
|
351
431
|
|
352
432
|
**Closed issues:**
|
353
433
|
|
@@ -363,6 +443,7 @@
|
|
363
443
|
|
364
444
|
**Fixed bugs:**
|
365
445
|
|
446
|
+
- Make the ruby reaper plain ruby [\#443](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/443) ([mhenrixon](https://github.com/mhenrixon))
|
366
447
|
- Pass redis\_version into scripts [\#431](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/431) ([mhenrixon](https://github.com/mhenrixon))
|
367
448
|
|
368
449
|
**Closed issues:**
|
@@ -505,10 +586,6 @@
|
|
505
586
|
|
506
587
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.7...v6.0.8)
|
507
588
|
|
508
|
-
**Fixed bugs:**
|
509
|
-
|
510
|
-
- Close \#359 [\#364](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/364) ([mhenrixon](https://github.com/mhenrixon))
|
511
|
-
|
512
589
|
**Closed issues:**
|
513
590
|
|
514
591
|
- Automatic unlock of jobs [\#362](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/362)
|
@@ -531,6 +608,7 @@
|
|
531
608
|
**Fixed bugs:**
|
532
609
|
|
533
610
|
- Version 5: Job ID Hash Entries Not Removed if Unique Key Expires [\#346](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/346)
|
611
|
+
- Close \#359 [\#364](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/364) ([mhenrixon](https://github.com/mhenrixon))
|
534
612
|
- Move the lpush last [\#354](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/354) ([mhenrixon](https://github.com/mhenrixon))
|
535
613
|
- Convert expiration time to integer [\#330](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/330) ([dareddov](https://github.com/dareddov))
|
536
614
|
|
@@ -545,7 +623,6 @@
|
|
545
623
|
- fix CHANGELOG syntax [\#344](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/344) ([timoschilling](https://github.com/timoschilling))
|
546
624
|
- Define Config class inside SidekiqUniqueJobs module [\#343](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/343) ([Slike9](https://github.com/Slike9))
|
547
625
|
- fix readme testing section [\#333](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/333) ([edmartins](https://github.com/edmartins))
|
548
|
-
- Fix typo in documentation \[ci-skip\] [\#327](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/327) ([mhenrixon](https://github.com/mhenrixon))
|
549
626
|
|
550
627
|
## [v5.0.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.11) (2018-11-19)
|
551
628
|
|
@@ -590,6 +667,10 @@
|
|
590
667
|
|
591
668
|
- Why is lock\_timeout: nil VERY DANGEROUS? [\#313](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/313)
|
592
669
|
|
670
|
+
**Merged pull requests:**
|
671
|
+
|
672
|
+
- Fix typo in documentation \[ci-skip\] [\#327](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/327) ([mhenrixon](https://github.com/mhenrixon))
|
673
|
+
|
593
674
|
## [v6.0.4](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.4) (2018-08-02)
|
594
675
|
|
595
676
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.3...v6.0.4)
|
@@ -662,6 +743,7 @@
|
|
662
743
|
|
663
744
|
**Merged pull requests:**
|
664
745
|
|
746
|
+
- Add more details about testing uniqueness [\#301](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/301) ([mhenrixon](https://github.com/mhenrixon))
|
665
747
|
- Update README.md [\#300](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/300) ([pirj](https://github.com/pirj))
|
666
748
|
|
667
749
|
## [v6.0.0.rc7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc7) (2018-07-23)
|
@@ -681,7 +763,6 @@
|
|
681
763
|
|
682
764
|
**Merged pull requests:**
|
683
765
|
|
684
|
-
- Add more details about testing uniqueness [\#301](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/301) ([mhenrixon](https://github.com/mhenrixon))
|
685
766
|
- Adds changelog entry [\#299](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/299) ([mhenrixon](https://github.com/mhenrixon))
|
686
767
|
- Fix README [\#298](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/298) ([mhenrixon](https://github.com/mhenrixon))
|
687
768
|
|
@@ -716,13 +797,16 @@
|
|
716
797
|
|
717
798
|
**Implemented enhancements:**
|
718
799
|
|
719
|
-
- Prepare for v6 [\#286](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/286) ([mhenrixon](https://github.com/mhenrixon))
|
720
800
|
- Only unlock not delete [\#285](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/285) ([mhenrixon](https://github.com/mhenrixon))
|
721
801
|
|
722
802
|
## [v6.0.0.rc3](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.rc3) (2018-06-29)
|
723
803
|
|
724
804
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.0.rc2...v6.0.0.rc3)
|
725
805
|
|
806
|
+
**Implemented enhancements:**
|
807
|
+
|
808
|
+
- Prepare for v6 [\#286](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/286) ([mhenrixon](https://github.com/mhenrixon))
|
809
|
+
|
726
810
|
**Fixed bugs:**
|
727
811
|
|
728
812
|
- Fix waiting for locks [\#284](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/284) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -735,6 +819,7 @@
|
|
735
819
|
|
736
820
|
- 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)
|
737
821
|
- Unexpected behavior with until\_executed [\#250](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/250)
|
822
|
+
- Fix UntilExpired [\#278](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/278) ([mhenrixon](https://github.com/mhenrixon))
|
738
823
|
|
739
824
|
**Fixed bugs:**
|
740
825
|
|
@@ -764,7 +849,6 @@
|
|
764
849
|
- Legacy support [\#280](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/280)
|
765
850
|
- Adds legacy support [\#281](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/281) ([mhenrixon](https://github.com/mhenrixon))
|
766
851
|
- Adds guard-reek [\#279](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/279) ([mhenrixon](https://github.com/mhenrixon))
|
767
|
-
- Fix UntilExpired [\#278](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/278) ([mhenrixon](https://github.com/mhenrixon))
|
768
852
|
|
769
853
|
## [v6.0.0.beta2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta2) (2018-06-25)
|
770
854
|
|
@@ -1204,7 +1288,6 @@
|
|
1204
1288
|
- Add after unlock hook [\#92](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/92) ([HParker](https://github.com/HParker))
|
1205
1289
|
- Do not unlock on sidekiq shutdown [\#87](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/87) ([deltaroe](https://github.com/deltaroe))
|
1206
1290
|
- 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))
|
1207
|
-
- 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))
|
1208
1291
|
- 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))
|
1209
1292
|
- Duplicate Payload logging configuration [\#81](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/81) ([jprincipe](https://github.com/jprincipe))
|
1210
1293
|
- output log if not unique [\#79](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/79) ([sonots](https://github.com/sonots))
|
@@ -1251,6 +1334,7 @@
|
|
1251
1334
|
|
1252
1335
|
**Merged pull requests:**
|
1253
1336
|
|
1337
|
+
- 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))
|
1254
1338
|
- Refactoring connectors to use them in client and server [\#56](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/56) ([salrepe](https://github.com/salrepe))
|
1255
1339
|
- Fix dependency error in inline testing connector [\#54](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/54) ([salrepe](https://github.com/salrepe))
|
1256
1340
|
- Add extension to Sidekiq API that is uniqueness-aware [\#52](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/52) ([rickenharp](https://github.com/rickenharp))
|
data/README.md
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
<!-- MarkdownTOC -->
|
4
4
|
|
5
5
|
- [Introduction](#introduction)
|
6
|
-
- [
|
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)
|
@@ -18,9 +21,11 @@
|
|
18
21
|
- [reaper_count](#reaper_count)
|
19
22
|
- [reaper_interval](#reaper_interval)
|
20
23
|
- [reaper_timeout](#reaper_timeout)
|
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)
|
@@ -33,15 +38,29 @@
|
|
33
38
|
- [While Executing](#while-executing)
|
34
39
|
- [Custom Locks](#custom-locks)
|
35
40
|
- [Conflict Strategy](#conflict-strategy)
|
36
|
-
- [
|
37
|
-
- [
|
38
|
-
- [
|
39
|
-
- [
|
40
|
-
- [
|
41
|
-
- [
|
42
|
-
- [
|
43
|
-
- [
|
44
|
-
- [
|
41
|
+
- [log](#log)
|
42
|
+
- [raise](#raise)
|
43
|
+
- [reject](#reject)
|
44
|
+
- [replace](#replace)
|
45
|
+
- [Reschedule](#reschedule)
|
46
|
+
- [Custom Strategies](#custom-strategies)
|
47
|
+
- [Usage](#usage-1)
|
48
|
+
- [Finer Control over Uniqueness](#finer-control-over-uniqueness)
|
49
|
+
- [After Unlock Callback](#after-unlock-callback)
|
50
|
+
- [Logging](#logging)
|
51
|
+
- [Cleanup Dead Locks](#cleanup-dead-locks)
|
52
|
+
- [Other Sidekiq gems](#other-sidekiq-gems)
|
53
|
+
- [apartment-sidekiq](#apartment-sidekiq)
|
54
|
+
- [sidekiq-global_id](#sidekiq-global_id)
|
55
|
+
- [sidekiq-status](#sidekiq-status)
|
56
|
+
- [Debugging](#debugging)
|
57
|
+
- [Sidekiq Web](#sidekiq-web)
|
58
|
+
- [Show Locks](#show-locks)
|
59
|
+
- [Show Lock](#show-lock)
|
60
|
+
- [Communication](#communication)
|
61
|
+
- [Testing](#testing)
|
62
|
+
- [Unique Sidekiq Configuration](#unique-sidekiq-configuration)
|
63
|
+
- [Uniqueness](#uniqueness)
|
45
64
|
- [Contributing](#contributing)
|
46
65
|
- [Contributors](#contributors)
|
47
66
|
|
@@ -49,30 +68,19 @@
|
|
49
68
|
|
50
69
|
## Introduction
|
51
70
|
|
52
|
-
The
|
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.
|
53
72
|
|
54
73
|
This is the documentation for the master branch. You can find the documentation for each release by navigating to its tag.
|
55
74
|
|
56
75
|
Here are links to some of the old versions
|
57
76
|
|
58
|
-
- [v6.0.
|
77
|
+
- [v6.0.25](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.25)
|
59
78
|
- [v5.0.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10)
|
60
79
|
- [v4.0.18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18)
|
61
80
|
|
62
|
-
##
|
63
|
-
|
64
|
-
- Sidekiq `>= 4.0` (`>= 5.2` recommended)
|
65
|
-
- Ruby:
|
66
|
-
- MRI `>= 2.3` (`>= 2.5` recommended)
|
67
|
-
- JRuby `>= 9.0` (`>= 9.2` recommended)
|
68
|
-
- Truffleruby
|
69
|
-
- Redis Server `>= 3.0.2` (`>= 3.2` recommended)
|
70
|
-
- [ActiveJob officially not supported][48]
|
71
|
-
- [redis-namespace officially not supported][49]
|
72
|
-
|
73
|
-
See [Sidekiq requirements][24] for detailed requirements of Sidekiq itself (be sure to check the right sidekiq version).
|
81
|
+
## Usage
|
74
82
|
|
75
|
-
|
83
|
+
### Installation
|
76
84
|
|
77
85
|
Add this line to your application's Gemfile:
|
78
86
|
|
@@ -86,16 +94,81 @@ And then execute:
|
|
86
94
|
bundle
|
87
95
|
```
|
88
96
|
|
89
|
-
|
97
|
+
### Add the middleware
|
98
|
+
|
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
|
+
[A full and hopefully working example](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/sidekiq.rb#L12)
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
Sidekiq.configure_server do |config|
|
105
|
+
config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }
|
106
|
+
|
107
|
+
config.server_middleware do |chain|
|
108
|
+
chain.add SidekiqUniqueJobs::Middleware::Server
|
109
|
+
end
|
110
|
+
|
111
|
+
config.error_handlers << ->(ex, ctx_hash) { p ex, ctx_hash }
|
112
|
+
config.death_handlers << lambda do |job, _ex|
|
113
|
+
digest = job["lock_digest"]
|
114
|
+
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
Sidekiq.configure_client do |config|
|
119
|
+
config.redis = { url: ENV["REDIS_URL"], driver: :hiredis }
|
120
|
+
|
121
|
+
config.client_middleware do |chain|
|
122
|
+
chain.add SidekiqUniqueJobs::Middleware::Client
|
123
|
+
end
|
124
|
+
end
|
125
|
+
```
|
126
|
+
|
127
|
+
### Your first worker
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
# frozen_string_literal: true
|
131
|
+
|
132
|
+
class UntilExecutedWorker
|
133
|
+
include Sidekiq::Worker
|
134
|
+
|
135
|
+
sidekiq_options queue: :special,
|
136
|
+
retry: false,
|
137
|
+
lock: :until_executed,
|
138
|
+
lock_info: true,
|
139
|
+
lock_timeout: 0,
|
140
|
+
lock_prefix: "special",
|
141
|
+
lock_ttl: 0,
|
142
|
+
lock_limit: 5
|
143
|
+
|
144
|
+
def perform
|
145
|
+
logger.info("cowboy")
|
146
|
+
sleep(1) # hardcore processing
|
147
|
+
logger.info("beebop")
|
148
|
+
end
|
149
|
+
end
|
90
150
|
|
91
|
-
```bash
|
92
|
-
gem install sidekiq-unique-jobs
|
93
151
|
```
|
94
152
|
|
153
|
+
You can read more about the worker configuration in [Worker Configuration](#worker-configuration) below.
|
154
|
+
|
95
155
|
## Support Me
|
96
156
|
|
97
157
|
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.
|
98
158
|
|
159
|
+
## Requirements
|
160
|
+
|
161
|
+
- Sidekiq `>= 4.0` (`>= 5.2` recommended)
|
162
|
+
- Ruby:
|
163
|
+
- MRI `>= 2.5` (`>= 2.6` recommended)
|
164
|
+
- JRuby `>= 9.0` (`>= 9.2` recommended)
|
165
|
+
- Truffleruby
|
166
|
+
- Redis Server `>= 3.0.2` (`>= 3.2` recommended)
|
167
|
+
- [ActiveJob officially not supported][48]
|
168
|
+
- [redis-namespace officially not supported][49]
|
169
|
+
|
170
|
+
See [Sidekiq requirements][24] for detailed requirements of Sidekiq itself (be sure to check the right sidekiq version).
|
171
|
+
|
99
172
|
## General Information
|
100
173
|
|
101
174
|
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.
|
@@ -106,6 +179,8 @@ See [Locking & Unlocking](https://github.com/mhenrixon/sidekiq-unique-jobs/wiki/
|
|
106
179
|
|
107
180
|
The gem supports a few different configuration options that might be of interest if you run into some weird issues.
|
108
181
|
|
182
|
+
Configure SidekiqUniqueJobs in an initializer or the sidekiq initializer on application startup.
|
183
|
+
|
109
184
|
```ruby
|
110
185
|
SidekiqUniqueJobs.configure do |config|
|
111
186
|
config.debug_lua = true
|
@@ -189,6 +264,14 @@ On the other hand if I increase it to 10 000 orphaned locks per cleanup (`reaper
|
|
189
264
|
|
190
265
|
> BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE. (Redis::CommandError)
|
191
266
|
|
267
|
+
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.
|
268
|
+
|
269
|
+
```ruby
|
270
|
+
SidekiqUniqueJobs.config.reaper = :none
|
271
|
+
SidekiqUniqueJobs.config.reaper = nil
|
272
|
+
SidekiqUniqueJobs.config.reaper = false
|
273
|
+
```
|
274
|
+
|
192
275
|
### reaper_count
|
193
276
|
|
194
277
|
```ruby
|
@@ -213,10 +296,10 @@ SidekiqUniqueJobs.config.reaper_timeout #=> 10
|
|
213
296
|
|
214
297
|
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
298
|
|
216
|
-
###
|
299
|
+
### lock_prefix
|
217
300
|
|
218
301
|
```ruby
|
219
|
-
SidekiqUniqueJobs.config.
|
302
|
+
SidekiqUniqueJobs.config.lock_prefix #=> "uniquejobs"
|
220
303
|
```
|
221
304
|
|
222
305
|
Use if you want a different key prefix for the keys in redis.
|
@@ -231,11 +314,27 @@ Using lock info will create an additional key for the lock with a json object co
|
|
231
314
|
|
232
315
|
## Worker Configuration
|
233
316
|
|
317
|
+
### lock_info
|
318
|
+
|
319
|
+
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.
|
320
|
+
|
321
|
+
```ruby
|
322
|
+
sidekiq_options lock_info: false # this is the default, set to true to turn on
|
323
|
+
```
|
324
|
+
|
325
|
+
### lock_prefix
|
326
|
+
|
327
|
+
Use if you want a different key prefix for the keys in redis.
|
328
|
+
|
329
|
+
```ruby
|
330
|
+
sidekiq_options lock_prefix: "uniquejobs" # this is the default value
|
331
|
+
```
|
332
|
+
|
234
333
|
### lock_ttl
|
235
334
|
|
236
335
|
Lock TTL decides how long to wait after the job has been successfully processed before making it possible to reuse that lock.
|
237
336
|
|
238
|
-
|
337
|
+
Starting from `v7` the expiration will take place when the job is pushed to the queue.
|
239
338
|
|
240
339
|
```ruby
|
241
340
|
sidekiq_options lock_ttl: nil # default - don't expire keys
|
@@ -256,6 +355,8 @@ sidekiq_options lock_timeout: nil # lock indefinitely, this process won't contin
|
|
256
355
|
|
257
356
|
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.
|
258
357
|
|
358
|
+
This is mainly intended for `Worker.set(queue: :another).perform_async`.
|
359
|
+
|
259
360
|
```ruby
|
260
361
|
class Worker
|
261
362
|
include Sidekiq::Worker
|
@@ -383,11 +484,9 @@ You can refer on all the locks defined in `lib/sidekiq_unique_jobs/lock/*.rb`.
|
|
383
484
|
|
384
485
|
In order to make it available, you should call in your project startup:
|
385
486
|
|
386
|
-
|
387
|
-
# For rails application
|
388
|
-
# config/initializers/sidekiq_unique_jobs.rb
|
389
|
-
# For other projects, whenever you prefer
|
487
|
+
(For rails application config/initializers/sidekiq_unique_jobs.rb or other projects, wherever you prefer)
|
390
488
|
|
489
|
+
```ruby
|
391
490
|
SidekiqUniqueJobs.configure do |config|
|
392
491
|
config.add_lock :my_custom_lock, Locks::MyCustomLock
|
393
492
|
end
|
@@ -408,7 +507,9 @@ The last one is log which can be be used with the lock `UntilExecuted` and `Unti
|
|
408
507
|
It is possible for locks to have different conflict strategy for the client and server. This is useful for `:until_and_while_executing`.
|
409
508
|
|
410
509
|
```ruby
|
411
|
-
sidekiq_options lock: :until_and_while_executing,
|
510
|
+
sidekiq_options lock: :until_and_while_executing,
|
511
|
+
on_conflict: { client: :log, server: :reject }
|
512
|
+
```
|
412
513
|
|
413
514
|
### log
|
414
515
|
|
@@ -474,11 +575,9 @@ You can refer to all the strategies defined in `lib/sidekiq_unique_jobs/on_confl
|
|
474
575
|
|
475
576
|
In order to make it available, you should call in your project startup:
|
476
577
|
|
477
|
-
|
478
|
-
# For rails application
|
479
|
-
# config/initializers/sidekiq_unique_jobs.rb
|
480
|
-
# For other projects, whenever you prefer
|
578
|
+
(For rails application config/initializers/sidekiq_unique_jobs.rb for other projects, wherever you prefer)
|
481
579
|
|
580
|
+
```ruby
|
482
581
|
SidekiqUniqueJobs.configure do |config|
|
483
582
|
config.add_strategy :my_custom_strategy, Strategies::MyCustomStrategy
|
484
583
|
end
|
@@ -516,7 +615,7 @@ The method or the proc can return a modified version of args without the transie
|
|
516
615
|
class UniqueJobWithFilterMethod
|
517
616
|
include Sidekiq::Worker
|
518
617
|
sidekiq_options lock: :until_and_while_executing,
|
519
|
-
|
618
|
+
lock_args_method: :lock_args # this is default and will be used if such a method is defined
|
520
619
|
|
521
620
|
def self.lock_args(args)
|
522
621
|
[ args[0], args[2][:type] ]
|
@@ -529,7 +628,7 @@ end
|
|
529
628
|
class UniqueJobWithFilterProc
|
530
629
|
include Sidekiq::Worker
|
531
630
|
sidekiq_options lock: :until_executed,
|
532
|
-
|
631
|
+
lock_args_method: ->(args) { [ args.first ] }
|
533
632
|
|
534
633
|
...
|
535
634
|
|
@@ -541,7 +640,7 @@ It is possible to ensure different types of unique args based on context. I can'
|
|
541
640
|
```ruby
|
542
641
|
class UniqueJobWithFilterMethod
|
543
642
|
include Sidekiq::Worker
|
544
|
-
sidekiq_options lock: :until_and_while_executing,
|
643
|
+
sidekiq_options lock: :until_and_while_executing, lock_args_method: :lock_args
|
545
644
|
|
546
645
|
def self.lock_args(args)
|
547
646
|
if Sidekiq::ProcessSet.new.size > 1
|
@@ -578,6 +677,7 @@ class UniqueJobWithFilterMethod
|
|
578
677
|
end
|
579
678
|
...
|
580
679
|
end.
|
680
|
+
```
|
581
681
|
|
582
682
|
### Logging
|
583
683
|
|
@@ -601,8 +701,8 @@ For sidekiq versions before 5.1 a `sidekiq_retries_exhausted` block is required
|
|
601
701
|
```ruby
|
602
702
|
class MyWorker
|
603
703
|
sidekiq_retries_exhausted do |msg, _ex|
|
604
|
-
digest = msg['
|
605
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
704
|
+
digest = msg['lock_digest']
|
705
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
606
706
|
end
|
607
707
|
end
|
608
708
|
```
|
@@ -610,21 +710,40 @@ end
|
|
610
710
|
Starting in v5.1, Sidekiq can also fire a global callback when a job dies:
|
611
711
|
|
612
712
|
```ruby
|
613
|
-
# this goes in your initializer
|
614
713
|
Sidekiq.configure_server do |config|
|
615
714
|
config.death_handlers << ->(job, _ex) do
|
616
|
-
digest = job['
|
617
|
-
SidekiqUniqueJobs::Digests.delete_by_digest(digest) if digest
|
715
|
+
digest = job['lock_digest']
|
716
|
+
SidekiqUniqueJobs::Digests.new.delete_by_digest(digest) if digest
|
618
717
|
end
|
619
718
|
end
|
620
719
|
```
|
621
720
|
|
622
721
|
### Other Sidekiq gems
|
623
722
|
|
723
|
+
#### apartment-sidekiq
|
724
|
+
|
725
|
+
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.
|
726
|
+
|
727
|
+
```ruby
|
728
|
+
Sidekiq.client_middleware do |chain|
|
729
|
+
chain.add Apartment::Sidekiq::Middleware::Client
|
730
|
+
chain.add SidekiqUniqueJobs::Middleware::Client
|
731
|
+
end
|
732
|
+
|
733
|
+
Sidekiq.server_middleware do |chain|
|
734
|
+
chain.add Apartment::Sidekiq::Middleware::Server
|
735
|
+
chain.add SidekiqUniqueJobs::Middleware::Server
|
736
|
+
end
|
737
|
+
```
|
738
|
+
|
739
|
+
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
|
740
|
+
|
624
741
|
#### sidekiq-global_id
|
625
742
|
|
626
743
|
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.
|
627
744
|
|
745
|
+
For a working setup check the following [file](https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/myapp/config/sidekiq.rb#L12).
|
746
|
+
|
628
747
|
```ruby
|
629
748
|
Sidekiq.client_middleware do |chain|
|
630
749
|
chain.add Sidekiq::GlobalId::ClientMiddleware
|
@@ -637,7 +756,25 @@ Sidekiq.server_middleware do |chain|
|
|
637
756
|
end
|
638
757
|
```
|
639
758
|
|
640
|
-
|
759
|
+
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.
|
760
|
+
|
761
|
+
#### sidekiq-status
|
762
|
+
|
763
|
+
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.
|
764
|
+
|
765
|
+
```ruby
|
766
|
+
Sidekiq.client_middleware do |chain|
|
767
|
+
chain.add Sidekiq::Status::ClientMiddleware, expiration: 10.minutes
|
768
|
+
chain.add Sidekiq::Status::ServerMiddleware
|
769
|
+
end
|
770
|
+
|
771
|
+
Sidekiq.server_middleware do |chain|
|
772
|
+
chain.add Sidekiq::Status::ServerMiddleware, expiration: 10.minutes
|
773
|
+
chain.add SidekiqUniqueJobs::Middleware::Server
|
774
|
+
end
|
775
|
+
```
|
776
|
+
|
777
|
+
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.
|
641
778
|
|
642
779
|
## Debugging
|
643
780
|
|
@@ -648,7 +785,7 @@ There are several ways of removing keys that are stuck. The prefered way is by u
|
|
648
785
|
To use the web extension you need to require it in your routes.
|
649
786
|
|
650
787
|
```ruby
|
651
|
-
#
|
788
|
+
#app/config/routes.rb
|
652
789
|
require 'sidekiq_unique_jobs/web'
|
653
790
|
mount Sidekiq::Web, at: '/sidekiq'
|
654
791
|
```
|
@@ -679,15 +816,15 @@ Since v7 it is possible to perform some simple validation against your workers s
|
|
679
816
|
Let's take a _bad_ worker:
|
680
817
|
|
681
818
|
```ruby
|
682
|
-
#
|
819
|
+
#app/workers/bad_worker.rb
|
683
820
|
class BadWorker
|
684
821
|
sidekiq_options lock: :while_executing, on_conflict: :replace
|
685
822
|
end
|
686
823
|
|
687
|
-
#
|
824
|
+
#spec/workers/bad_worker_spec.rb
|
688
825
|
|
689
826
|
require "sidekiq_unique_jobs/testing"
|
690
|
-
#
|
827
|
+
#OR
|
691
828
|
require "sidekiq_unique_jobs/rspec/matchers"
|
692
829
|
|
693
830
|
RSpec.describe BadWorker do
|