sidekiq-unique-jobs 7.1.12 → 7.1.14
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 +35 -1
- data/README.md +1 -1
- data/lib/sidekiq_unique_jobs/batch_delete.rb +6 -6
- data/lib/sidekiq_unique_jobs/changelog.rb +3 -3
- data/lib/sidekiq_unique_jobs/digests.rb +3 -3
- data/lib/sidekiq_unique_jobs/lock.rb +10 -10
- data/lib/sidekiq_unique_jobs/lock_info.rb +2 -2
- data/lib/sidekiq_unique_jobs/on_conflict/reject.rb +4 -4
- data/lib/sidekiq_unique_jobs/orphans/ruby_reaper.rb +5 -5
- data/lib/sidekiq_unique_jobs/redis/string.rb +3 -1
- data/lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb +1 -1
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +13 -3
- data/lib/sidekiq_unique_jobs/timing.rb +1 -1
- data/lib/sidekiq_unique_jobs/upgrade_locks.rb +6 -6
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/web/helpers.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 282d21cd3a381132e1a4cbe3852e158f3bd9d5b80430cf58b5192d3879282d53
|
4
|
+
data.tar.gz: 396796dfb7757f83fed54835495334993304dd144c6aebad129b736b30b38107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26ed510d584ce8c4c00db7fdaa8b8267dfa58014d01bb5857e3ccf1ce974256a0e8dc82187dee9cb6bdfad4bdc97ead436ca10d707cae44954df55a3ef3c552a
|
7
|
+
data.tar.gz: 94d354d3f405e23562588d0df93ce54fd3883c45c4a1e40dac40516d41bbf3e0b97e9ab3a57883d957a1d6de2b10f4fa1544e03f8f2e845bf39c6639c04ba1b1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,39 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.1.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.13) (2022-02-03)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.12...v7.1.13)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Prepare for redis 5.0.0 [\#680](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/680) ([mhenrixon](https://github.com/mhenrixon))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- Fix homepage url [\#667](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/667) ([dal-ioki](https://github.com/dal-ioki))
|
14
|
+
|
15
|
+
**Closed issues:**
|
16
|
+
|
17
|
+
- Job finished, but lock is not cleared [\#677](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/677)
|
18
|
+
- sidekiq\_options lock conflicts with sidekiq-lock gem lock option [\#669](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/669)
|
19
|
+
- Slow evalsha causing timeouts [\#668](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/668)
|
20
|
+
- Inconsistent documentation for config validation [\#647](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/647)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- Bump bundler and friends [\#674](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/674) ([mhenrixon](https://github.com/mhenrixon))
|
25
|
+
- readme: fix minitest assertion. [\#672](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/672) ([crondaemon](https://github.com/crondaemon))
|
26
|
+
- Pass `item` in `after_unlock` callback [\#665](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/665) ([piloos](https://github.com/piloos))
|
27
|
+
|
28
|
+
## [v7.1.12](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.12) (2021-12-01)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.11...v7.1.12)
|
31
|
+
|
32
|
+
**Implemented enhancements:**
|
33
|
+
|
34
|
+
- Improve Ruby Reaper performance under heavy load [\#663](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/663)
|
35
|
+
- Improve reaper performance under heavy load [\#666](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/666) ([mhenrixon](https://github.com/mhenrixon))
|
36
|
+
|
3
37
|
## [v7.1.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.11) (2021-11-30)
|
4
38
|
|
5
39
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.10...v7.1.11)
|
@@ -136,7 +170,7 @@
|
|
136
170
|
**Implemented enhancements:**
|
137
171
|
|
138
172
|
- Reflections [\#611](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/611) ([mhenrixon](https://github.com/mhenrixon))
|
139
|
-
- Start new orphan reaper process if orphan reaper is not running [\#604](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/604) ([
|
173
|
+
- Start new orphan reaper process if orphan reaper is not running [\#604](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/604) ([AlexFlint73](https://github.com/AlexFlint73))
|
140
174
|
|
141
175
|
**Fixed bugs:**
|
142
176
|
|
data/README.md
CHANGED
@@ -599,7 +599,7 @@ Expected BadWorker to have valid sidekiq options but found the following problem
|
|
599
599
|
If you are not using RSpec (a lot of people prefer minitest or test unit) you can do something like:
|
600
600
|
|
601
601
|
```ruby
|
602
|
-
|
602
|
+
assert_raise(InvalidWorker){ SidekiqUniqueJobs.validate_worker!(BadWorker.get_sidekiq_options) }
|
603
603
|
```
|
604
604
|
|
605
605
|
### Uniqueness
|
@@ -87,10 +87,10 @@ module SidekiqUniqueJobs
|
|
87
87
|
#
|
88
88
|
def batch_delete(conn)
|
89
89
|
digests.each_slice(BATCH_SIZE) do |chunk|
|
90
|
-
conn.pipelined do
|
90
|
+
conn.pipelined do |pipeline|
|
91
91
|
chunk.each do |digest|
|
92
|
-
del_digest(
|
93
|
-
|
92
|
+
del_digest(pipeline, digest)
|
93
|
+
pipeline.zrem(SidekiqUniqueJobs::DIGESTS, digest)
|
94
94
|
@count += 1
|
95
95
|
end
|
96
96
|
end
|
@@ -99,13 +99,13 @@ module SidekiqUniqueJobs
|
|
99
99
|
@count
|
100
100
|
end
|
101
101
|
|
102
|
-
def del_digest(
|
102
|
+
def del_digest(pipeline, digest)
|
103
103
|
removable_keys = keys_for_digest(digest)
|
104
104
|
|
105
105
|
if VersionCheck.satisfied?(redis_version, ">= 4.0.0")
|
106
|
-
|
106
|
+
pipeline.unlink(*removable_keys)
|
107
107
|
else
|
108
|
-
|
108
|
+
pipeline.del(*removable_keys)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -62,9 +62,9 @@ module SidekiqUniqueJobs
|
|
62
62
|
#
|
63
63
|
def page(cursor: 0, pattern: "*", page_size: 100)
|
64
64
|
redis do |conn|
|
65
|
-
total_size, result = conn.multi do
|
66
|
-
|
67
|
-
|
65
|
+
total_size, result = conn.multi do |pipeline|
|
66
|
+
pipeline.zcard(key)
|
67
|
+
pipeline.zscan(key, cursor, match: pattern, count: page_size)
|
68
68
|
end
|
69
69
|
|
70
70
|
[
|
@@ -95,9 +95,9 @@ module SidekiqUniqueJobs
|
|
95
95
|
#
|
96
96
|
def page(cursor: 0, pattern: SCAN_PATTERN, page_size: 100)
|
97
97
|
redis do |conn|
|
98
|
-
total_size, digests = conn.multi do
|
99
|
-
|
100
|
-
|
98
|
+
total_size, digests = conn.multi do |pipeline|
|
99
|
+
pipeline.zcard(key)
|
100
|
+
pipeline.zscan(key, cursor, match: pattern, count: page_size)
|
101
101
|
end
|
102
102
|
|
103
103
|
[
|
@@ -62,13 +62,13 @@ module SidekiqUniqueJobs
|
|
62
62
|
#
|
63
63
|
def lock(job_id, lock_info = {})
|
64
64
|
redis do |conn|
|
65
|
-
conn.multi do
|
66
|
-
|
67
|
-
|
68
|
-
info.set(lock_info)
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
conn.multi do |pipeline|
|
66
|
+
pipeline.set(key.digest, job_id)
|
67
|
+
pipeline.hset(key.locked, job_id, now_f)
|
68
|
+
info.set(lock_info, pipeline)
|
69
|
+
pipeline.zadd(key.digests, now_f, key.digest)
|
70
|
+
pipeline.zadd(key.changelog, now_f, changelog_json(job_id, "queue.lua", "Queued"))
|
71
|
+
pipeline.zadd(key.changelog, now_f, changelog_json(job_id, "lock.lua", "Locked"))
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -123,9 +123,9 @@ module SidekiqUniqueJobs
|
|
123
123
|
#
|
124
124
|
def del
|
125
125
|
redis do |conn|
|
126
|
-
conn.multi do
|
127
|
-
|
128
|
-
|
126
|
+
conn.multi do |pipeline|
|
127
|
+
pipeline.zrem(DIGESTS, key.digest)
|
128
|
+
pipeline.del(key.digest, key.queued, key.primed, key.locked, key.info)
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -55,13 +55,13 @@ module SidekiqUniqueJobs
|
|
55
55
|
#
|
56
56
|
# @return [Hash]
|
57
57
|
#
|
58
|
-
def set(obj)
|
58
|
+
def set(obj, pipeline = nil)
|
59
59
|
return unless SidekiqUniqueJobs.config.lock_info
|
60
60
|
raise InvalidArgument, "argument `obj` (#{obj}) needs to be a hash" unless obj.is_a?(Hash)
|
61
61
|
|
62
62
|
json = dump_json(obj)
|
63
63
|
@value = load_json(json)
|
64
|
-
super(json)
|
64
|
+
super(json, pipeline)
|
65
65
|
value
|
66
66
|
end
|
67
67
|
end
|
@@ -96,10 +96,10 @@ module SidekiqUniqueJobs
|
|
96
96
|
#
|
97
97
|
def push_to_deadset
|
98
98
|
redis do |conn|
|
99
|
-
conn.multi do
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
conn.multi do |pipeline|
|
100
|
+
pipeline.zadd("dead", now_f, payload)
|
101
|
+
pipeline.zremrangebyscore("dead", "-inf", now_f - Sidekiq::DeadSet.timeout)
|
102
|
+
pipeline.zremrangebyrank("dead", 0, -Sidekiq::DeadSet.max_jobs)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -141,14 +141,14 @@ module SidekiqUniqueJobs
|
|
141
141
|
return false if procs.empty?
|
142
142
|
|
143
143
|
procs.sort.each do |key|
|
144
|
-
valid, workers = conn.pipelined do
|
144
|
+
valid, workers = conn.pipelined do |pipeline|
|
145
145
|
# TODO: Remove the if statement in the future
|
146
|
-
if
|
147
|
-
|
146
|
+
if pipeline.respond_to?(:exists?)
|
147
|
+
pipeline.exists?(key)
|
148
148
|
else
|
149
|
-
|
149
|
+
pipeline.exists(key)
|
150
150
|
end
|
151
|
-
|
151
|
+
pipeline.hgetall("#{key}:workers")
|
152
152
|
end
|
153
153
|
|
154
154
|
next unless valid
|
@@ -34,12 +34,22 @@ module SidekiqUniqueJobs
|
|
34
34
|
|
35
35
|
# The hook to call after a successful unlock
|
36
36
|
# @return [Proc]
|
37
|
-
def after_unlock_hook
|
37
|
+
def after_unlock_hook # rubocop:disable Metrics/MethodLength
|
38
38
|
lambda do
|
39
39
|
if @worker_class.respond_to?(:after_unlock)
|
40
|
-
|
40
|
+
# instance method in sidekiq v6
|
41
|
+
if @worker_class.method(:after_unlock).arity.positive? # arity check to maintain backwards compatibility
|
42
|
+
@worker_class.after_unlock(item)
|
43
|
+
else
|
44
|
+
@worker_class.after_unlock
|
45
|
+
end
|
41
46
|
elsif worker_class.respond_to?(:after_unlock)
|
42
|
-
|
47
|
+
# class method regardless of sidekiq version
|
48
|
+
if worker_class.method(:after_unlock).arity.positive? # arity check to maintain backwards compatibility
|
49
|
+
worker_class.after_unlock(item)
|
50
|
+
else
|
51
|
+
worker_class.after_unlock
|
52
|
+
end
|
43
53
|
end
|
44
54
|
end
|
45
55
|
end
|
@@ -87,9 +87,9 @@ module SidekiqUniqueJobs
|
|
87
87
|
digest = grabbed_key.gsub(":GRABBED", "")
|
88
88
|
locks = conn.hgetall(grabbed_key)
|
89
89
|
|
90
|
-
conn.pipelined do
|
91
|
-
|
92
|
-
|
90
|
+
conn.pipelined do |pipeline|
|
91
|
+
pipeline.hmset(locked_key, *locks.to_a)
|
92
|
+
pipeline.zadd(DIGESTS, locks.values.first, digest)
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -114,11 +114,11 @@ module SidekiqUniqueJobs
|
|
114
114
|
def batch_delete(*keys)
|
115
115
|
return if keys.empty?
|
116
116
|
|
117
|
-
conn.pipelined do
|
117
|
+
conn.pipelined do |pipeline|
|
118
118
|
if VersionCheck.satisfied?(redis_version, ">= 4.0.0")
|
119
|
-
|
119
|
+
pipeline.unlink(*keys)
|
120
120
|
else
|
121
|
-
|
121
|
+
pipeline.del(*keys)
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-unique-jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.1.
|
4
|
+
version: 7.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpoplpush-redis_script
|
@@ -211,7 +211,7 @@ files:
|
|
211
211
|
- lib/sidekiq_unique_jobs/web/views/lock.erb
|
212
212
|
- lib/sidekiq_unique_jobs/web/views/locks.erb
|
213
213
|
- lib/tasks/changelog.rake
|
214
|
-
homepage: https://
|
214
|
+
homepage: https://github.com/mhenrixon/sidekiq-unique-jobs
|
215
215
|
licenses:
|
216
216
|
- MIT
|
217
217
|
metadata:
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
- !ruby/object:Gem::Version
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
|
-
rubygems_version: 3.
|
260
|
+
rubygems_version: 3.3.6
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: Sidekiq middleware that prevents duplicates jobs
|