sidekiq-unique-jobs 7.0.0.beta8 → 7.0.0.beta9
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 +19 -0
- data/lib/sidekiq_unique_jobs/locksmith.rb +7 -5
- data/lib/sidekiq_unique_jobs/middleware.rb +1 -1
- data/lib/sidekiq_unique_jobs/on_conflict/reschedule.rb +8 -1
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +12 -0
- data/lib/sidekiq_unique_jobs/profiler.rb +6 -2
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- data/lib/sidekiq_unique_jobs/web.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a24246a99460117c9ebacb054dc8d1860e3a330058f3c4f34d409125136ffc22
|
4
|
+
data.tar.gz: 662a626190317ed24ecc5453a936437824166bf5b08cbb9e96187bb63f1d091b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a406b1f3f3f73a39f4c50b44417cbc1b6a83492c5e5c4dea71055cda9eca8c5139e667d2a1d4363e952f07e4e918b96455734cfd6285a753cdf3af026c2ab7eb
|
7
|
+
data.tar.gz: 99742c266e02ef86cfefd96a3c694b986f6d5610fca49877b7fd0f5d14ddcef4abadb6e65ae00b53de1fe71830d74210a9f7ff3237e3aecb141f9c9c5efdcf30
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.0.0.beta8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta8) (2019-11-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta7...v7.0.0.beta8)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Allow worker to configure client and server strategies separately [\#402](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/402)
|
10
|
+
- Separate client and server on\_conflict [\#462](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/462) ([mhenrixon](https://github.com/mhenrixon))
|
11
|
+
|
12
|
+
**Fixed bugs:**
|
13
|
+
|
14
|
+
- `while\_executing` has problems at low concurrency [\#384](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/384)
|
15
|
+
- lock: :until\_and\_while\_executing not working for scheduled jobs [\#334](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/334)
|
16
|
+
|
17
|
+
**Closed issues:**
|
18
|
+
|
19
|
+
- Custom Locks with error [\#392](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/392)
|
20
|
+
- :until\_executed jobs get stuck every now and then [\#379](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/379)
|
21
|
+
|
3
22
|
## [v7.0.0.beta7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta7) (2019-11-28)
|
4
23
|
|
5
24
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta6...v7.0.0.beta7)
|
@@ -177,7 +177,7 @@ module SidekiqUniqueJobs
|
|
177
177
|
enqueue(conn) do
|
178
178
|
primed_async(conn) do
|
179
179
|
locked_token = call_script(:lock, key.to_a, argv, conn)
|
180
|
-
return yield
|
180
|
+
return yield if locked_token == job_id
|
181
181
|
end
|
182
182
|
end
|
183
183
|
ensure
|
@@ -195,7 +195,9 @@ module SidekiqUniqueJobs
|
|
195
195
|
# @return [Object] whatever the block returns when lock was acquired
|
196
196
|
#
|
197
197
|
def primed_async(conn)
|
198
|
-
return yield if Concurrent::Promises
|
198
|
+
return yield if Concurrent::Promises
|
199
|
+
.future(conn) { |red_con| pop_queued(red_con) }
|
200
|
+
.value(drift(config.ttl))
|
199
201
|
|
200
202
|
warn_about_timeout
|
201
203
|
end
|
@@ -211,12 +213,12 @@ module SidekiqUniqueJobs
|
|
211
213
|
# @yieldparam [String] job_id a Sidekiq JID
|
212
214
|
#
|
213
215
|
def lock_sync(conn)
|
214
|
-
return yield
|
216
|
+
return yield if locked?(conn)
|
215
217
|
|
216
218
|
enqueue(conn) do
|
217
219
|
primed_sync(conn) do
|
218
220
|
locked_token = call_script(:lock, key.to_a, argv, conn)
|
219
|
-
return yield
|
221
|
+
return yield if locked_token
|
220
222
|
end
|
221
223
|
end
|
222
224
|
end
|
@@ -284,7 +286,7 @@ module SidekiqUniqueJobs
|
|
284
286
|
return unless queued_token && (validity >= 0 || config.pttl.zero?)
|
285
287
|
|
286
288
|
write_lock_info(conn)
|
287
|
-
yield
|
289
|
+
yield
|
288
290
|
end
|
289
291
|
|
290
292
|
#
|
@@ -7,6 +7,8 @@ module SidekiqUniqueJobs
|
|
7
7
|
# @author Mikael Henriksson <mikael@zoolutions.se>
|
8
8
|
class Reschedule < OnConflict::Strategy
|
9
9
|
include SidekiqUniqueJobs::SidekiqWorkerMethods
|
10
|
+
include SidekiqUniqueJobs::Logging
|
11
|
+
include SidekiqUniqueJobs::JSON
|
10
12
|
|
11
13
|
# @param [Hash] item sidekiq job hash
|
12
14
|
def initialize(item, redis_pool = nil)
|
@@ -17,7 +19,12 @@ module SidekiqUniqueJobs
|
|
17
19
|
# Create a new job from the current one.
|
18
20
|
# This will mess up sidekiq stats because a new job is created
|
19
21
|
def call
|
20
|
-
|
22
|
+
if sidekiq_worker_class?
|
23
|
+
log_info("Rescheduling #{item[UNIQUE_DIGEST]}")
|
24
|
+
worker_class&.perform_in(5, *item[ARGS])
|
25
|
+
else
|
26
|
+
log_warn("Skip rescheduling of #{item[UNIQUE_DIGEST]} because #{worker_class} is not a Sidekiq::Worker")
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -21,6 +21,7 @@ module SidekiqUniqueJobs
|
|
21
21
|
#
|
22
22
|
def start # rubocop:disable
|
23
23
|
return if registered?
|
24
|
+
return if disabled?
|
24
25
|
|
25
26
|
with_logging_context do
|
26
27
|
register_reaper_process
|
@@ -73,6 +74,13 @@ module SidekiqUniqueJobs
|
|
73
74
|
timeout_interval: reaper_timeout }
|
74
75
|
end
|
75
76
|
|
77
|
+
#
|
78
|
+
# @see SidekiqUniqueJobs::Config#reaper
|
79
|
+
#
|
80
|
+
def reaper
|
81
|
+
SidekiqUniqueJobs.config.reaper
|
82
|
+
end
|
83
|
+
|
76
84
|
#
|
77
85
|
# @see SidekiqUniqueJobs::Config#reaper_interval
|
78
86
|
#
|
@@ -112,6 +120,10 @@ module SidekiqUniqueJobs
|
|
112
120
|
redis { |conn| conn.get(UNIQUE_REAPER) }.to_i == 1
|
113
121
|
end
|
114
122
|
|
123
|
+
def disabled?
|
124
|
+
reaper == :none
|
125
|
+
end
|
126
|
+
|
115
127
|
#
|
116
128
|
# Writes a mutex key to redis
|
117
129
|
#
|
@@ -34,12 +34,12 @@ module SidekiqUniqueJobs
|
|
34
34
|
|
35
35
|
def self.start
|
36
36
|
Thread.current[:_method_profiler] = {
|
37
|
-
__start:
|
37
|
+
__start: current_timestamp,
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.stop
|
42
|
-
finish =
|
42
|
+
finish = current_timestamp
|
43
43
|
return unless (data = Thread.current[:_method_profiler])
|
44
44
|
|
45
45
|
Thread.current[:_method_profiler] = nil
|
@@ -47,5 +47,9 @@ module SidekiqUniqueJobs
|
|
47
47
|
data[:total_duration] = finish - start
|
48
48
|
data
|
49
49
|
end
|
50
|
+
|
51
|
+
def self.current_timestamp
|
52
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
53
|
+
end
|
50
54
|
end
|
51
55
|
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.0.0.
|
4
|
+
version: 7.0.0.beta9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpoplpush-redis_script
|