sidekiq-unique-jobs 7.0.0.beta15 → 7.0.0.beta20
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 +82 -6
- data/lib/sidekiq_unique_jobs/config.rb +28 -2
- data/lib/sidekiq_unique_jobs/core_ext.rb +42 -0
- data/lib/sidekiq_unique_jobs/job.rb +8 -0
- data/lib/sidekiq_unique_jobs/lock_args.rb +0 -1
- data/lib/sidekiq_unique_jobs/lock_config.rb +3 -3
- data/lib/sidekiq_unique_jobs/lock_timeout.rb +2 -2
- data/lib/sidekiq_unique_jobs/lock_ttl.rb +3 -14
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +25 -2
- data/lib/sidekiq_unique_jobs/sidekiq_unique_jobs.rb +2 -1
- data/lib/sidekiq_unique_jobs/sidekiq_worker_methods.rb +1 -1
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- metadata +14 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb9187151e279ce0c7d654c62b86c57d3ae6ba21639206050943b72032df9f03
|
4
|
+
data.tar.gz: 54aaf4e5179a445ebc551705a68ea177c7cc16c29f5e06d3d8287a683176c58b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0c34048dd03e862038d92f2b092b03102593899f1c9b30f290dc8ef6a960b67b7583ae82e84d40d69cc001eff1342bb4c7092abfdb6269e8bc8adae2752c79
|
7
|
+
data.tar.gz: 22ea78f67d06a986f3accc92799d83f1c18cba92d4ca2f2a1cebb386d902f6f4105bcd52e4a4235388748c95edca0efa7befe622ed24d25ab509ad4281bc9ced
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,81 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta19...HEAD)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Reaper can't be registered again if sidekiq gets killed by SIGKILL [\#490](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/490)
|
10
|
+
|
11
|
+
## [v7.0.0.beta19](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta19) (2020-05-21)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta18...v7.0.0.beta19)
|
14
|
+
|
15
|
+
**Fixed bugs:**
|
16
|
+
|
17
|
+
- Expire reaper when not checking in [\#508](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/508) ([mhenrixon](https://github.com/mhenrixon))
|
18
|
+
|
19
|
+
## [v7.0.0.beta18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta18) (2020-05-21)
|
20
|
+
|
21
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta17...v7.0.0.beta18)
|
22
|
+
|
23
|
+
**Fixed bugs:**
|
24
|
+
|
25
|
+
- Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
|
26
|
+
|
27
|
+
## [v7.0.0.beta17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta17) (2020-05-20)
|
28
|
+
|
29
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta16...v7.0.0.beta17)
|
30
|
+
|
31
|
+
**Implemented enhancements:**
|
32
|
+
|
33
|
+
- Try GitHub actions [\#505](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/505) ([mhenrixon](https://github.com/mhenrixon))
|
34
|
+
|
35
|
+
**Fixed bugs:**
|
36
|
+
|
37
|
+
- Deep stringify worker options to account for hash in on\_conflict [\#506](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/506) ([jasonbekolay](https://github.com/jasonbekolay))
|
38
|
+
|
39
|
+
## [v7.0.0.beta16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta16) (2020-05-19)
|
40
|
+
|
41
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.22...v7.0.0.beta16)
|
42
|
+
|
43
|
+
**Fixed bugs:**
|
44
|
+
|
45
|
+
- Deprecate configuration options with `default\_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
|
46
|
+
- Fix access to both server and client conflict [\#503](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/503) ([mhenrixon](https://github.com/mhenrixon))
|
47
|
+
|
48
|
+
**Closed issues:**
|
49
|
+
|
50
|
+
- V7 Beta 15 `on\_conflict:` with Hash does not work on server [\#499](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/499)
|
51
|
+
|
52
|
+
## [v6.0.22](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.22) (2020-04-13)
|
53
|
+
|
54
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta15...v6.0.22)
|
55
|
+
|
56
|
+
**Fixed bugs:**
|
57
|
+
|
58
|
+
- \[LockType\] Allow overwriting default lock type at item level [\#497](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/497) ([EmmN](https://github.com/EmmN))
|
59
|
+
|
60
|
+
## [v7.0.0.beta15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta15) (2020-04-10)
|
61
|
+
|
62
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta14...v7.0.0.beta15)
|
63
|
+
|
64
|
+
**Implemented enhancements:**
|
65
|
+
|
66
|
+
- Duplicated scripts [\#492](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/492)
|
67
|
+
- CI: Use jruby-9.2.11.1 [\#485](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/485) ([olleolleolle](https://github.com/olleolleolle))
|
68
|
+
|
69
|
+
**Fixed bugs:**
|
70
|
+
|
71
|
+
- V7 - `on\_conflict:` no longer accepts a Hash [\#495](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/495)
|
72
|
+
- Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
|
73
|
+
- Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
|
74
|
+
- Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
|
75
|
+
- Fix access to hash members [\#496](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/496) ([mhenrixon](https://github.com/mhenrixon))
|
76
|
+
- Fix cursor assignment [\#494](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/494) ([mhenrixon](https://github.com/mhenrixon))
|
77
|
+
- Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
|
78
|
+
|
3
79
|
## [v7.0.0.beta14](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta14) (2020-03-30)
|
4
80
|
|
5
81
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.21...v7.0.0.beta14)
|
@@ -133,6 +209,10 @@
|
|
133
209
|
|
134
210
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.18...v7.0.0.beta6)
|
135
211
|
|
212
|
+
**Implemented enhancements:**
|
213
|
+
|
214
|
+
- Clarify usage with global\_id and sidekiq-status [\#455](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/455) ([mhenrixon](https://github.com/mhenrixon))
|
215
|
+
|
136
216
|
**Merged pull requests:**
|
137
217
|
|
138
218
|
- Fix that Sidekiq now sends instance of worker [\#459](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/459) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -175,10 +255,6 @@
|
|
175
255
|
|
176
256
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.16...v6.0.17)
|
177
257
|
|
178
|
-
**Implemented enhancements:**
|
179
|
-
|
180
|
-
- Clarify usage with global\_id and sidekiq-status [\#455](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/455) ([mhenrixon](https://github.com/mhenrixon))
|
181
|
-
|
182
258
|
**Fixed bugs:**
|
183
259
|
|
184
260
|
- Allow redis namespace to work with deletion [\#451](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/451) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -473,7 +549,6 @@
|
|
473
549
|
**Fixed bugs:**
|
474
550
|
|
475
551
|
- Enable replace strategy [\#315](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/315) ([mhenrixon](https://github.com/mhenrixon))
|
476
|
-
- Remove unused method [\#307](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/307) ([mhenrixon](https://github.com/mhenrixon))
|
477
552
|
|
478
553
|
**Closed issues:**
|
479
554
|
|
@@ -499,6 +574,7 @@
|
|
499
574
|
**Fixed bugs:**
|
500
575
|
|
501
576
|
- :until\_executed is throwing errors and not requeuing the job. [\#256](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/256)
|
577
|
+
- Remove unused method [\#307](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/307) ([mhenrixon](https://github.com/mhenrixon))
|
502
578
|
|
503
579
|
**Closed issues:**
|
504
580
|
|
@@ -840,6 +916,7 @@
|
|
840
916
|
- missed space [\#188](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/188) ([TheBigSadowski](https://github.com/TheBigSadowski))
|
841
917
|
- Convert unless if to just 1 if [\#179](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/179) ([otzy007](https://github.com/otzy007))
|
842
918
|
- 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))
|
919
|
+
- Fixed gitter badge link [\#176](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/176) ([andrew](https://github.com/andrew))
|
843
920
|
|
844
921
|
## [v4.0.17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.17) (2016-03-02)
|
845
922
|
|
@@ -855,7 +932,6 @@
|
|
855
932
|
|
856
933
|
**Merged pull requests:**
|
857
934
|
|
858
|
-
- Fixed gitter badge link [\#176](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/176) ([andrew](https://github.com/andrew))
|
859
935
|
- Fix for sidekiq delete failing for version 3.4.x [\#167](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/167) ([theprogrammerin](https://github.com/theprogrammerin))
|
860
936
|
- Run lock timeout configurable [\#164](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/164) ([Slania](https://github.com/Slania))
|
861
937
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module SidekiqUniqueJobs
|
4
4
|
# ThreadSafe config exists to be able to document the config class without errors
|
5
5
|
ThreadSafeConfig = Concurrent::MutableStruct.new("ThreadSafeConfig",
|
6
|
-
:
|
7
|
-
:
|
6
|
+
:lock_timeout,
|
7
|
+
:lock_ttl,
|
8
8
|
:enabled,
|
9
9
|
:unique_prefix,
|
10
10
|
:logger,
|
@@ -24,6 +24,7 @@ module SidekiqUniqueJobs
|
|
24
24
|
# Shared class for dealing with gem configuration
|
25
25
|
#
|
26
26
|
# @author Mauro Berlanda <mauro.berlanda@gmail.com>
|
27
|
+
# rubocop:disable Metrics/ClassLength
|
27
28
|
class Config < ThreadSafeConfig
|
28
29
|
#
|
29
30
|
# @return [Hash<Symbol, SidekiqUniqueJobs::Lock::BaseLock] all available queued locks
|
@@ -183,6 +184,30 @@ module SidekiqUniqueJobs
|
|
183
184
|
)
|
184
185
|
end
|
185
186
|
|
187
|
+
def default_lock_ttl=(obj)
|
188
|
+
warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_ttl=` instead."
|
189
|
+
self.lock_ttl = obj
|
190
|
+
end
|
191
|
+
|
192
|
+
def default_lock_timeout=(obj)
|
193
|
+
warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_timeout=` instead."
|
194
|
+
self.lock_timeout = obj
|
195
|
+
end
|
196
|
+
|
197
|
+
def default_lock_ttl
|
198
|
+
warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_ttl` instead."
|
199
|
+
lock_ttl
|
200
|
+
end
|
201
|
+
|
202
|
+
def default_lock_timeout
|
203
|
+
warn "[DEPRECATION] `#{class_name}##{__method__}` is deprecated. Please use `#{class_name}#lock_timeout` instead."
|
204
|
+
lock_timeout
|
205
|
+
end
|
206
|
+
|
207
|
+
def class_name
|
208
|
+
@class_name ||= self.class.name
|
209
|
+
end
|
210
|
+
|
186
211
|
#
|
187
212
|
# Adds a lock type to the configuration. It will raise if the lock exists already
|
188
213
|
#
|
@@ -234,4 +259,5 @@ module SidekiqUniqueJobs
|
|
234
259
|
current_redis_version
|
235
260
|
end
|
236
261
|
end
|
262
|
+
# rubocop:enable Metrics/ClassLength
|
237
263
|
end
|
@@ -20,6 +20,30 @@ class Hash
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
unless {}.respond_to?(:deep_stringify_keys)
|
24
|
+
#
|
25
|
+
# Depp converts all keys to string
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# @return [Hash<String>]
|
29
|
+
#
|
30
|
+
def deep_stringify_keys
|
31
|
+
deep_transform_keys(&:to_s)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
unless {}.respond_to?(:deep_transform_keys)
|
36
|
+
#
|
37
|
+
# Deep transfor all keys by yielding to the caller
|
38
|
+
#
|
39
|
+
#
|
40
|
+
# @return [Hash<String>]
|
41
|
+
#
|
42
|
+
def deep_transform_keys(&block)
|
43
|
+
_deep_transform_keys_in_object(self, &block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
23
47
|
unless {}.respond_to?(:stringify_keys)
|
24
48
|
#
|
25
49
|
# Converts all keys to string
|
@@ -66,6 +90,24 @@ class Hash
|
|
66
90
|
omit
|
67
91
|
end
|
68
92
|
end
|
93
|
+
|
94
|
+
private
|
95
|
+
|
96
|
+
unless {}.respond_to?(:_deep_transform_keys_in_object)
|
97
|
+
# support methods for deep transforming nested hashes and arrays
|
98
|
+
def _deep_transform_keys_in_object(object, &block)
|
99
|
+
case object
|
100
|
+
when Hash
|
101
|
+
object.each_with_object({}) do |(key, value), result|
|
102
|
+
result[yield(key)] = _deep_transform_keys_in_object(value, &block)
|
103
|
+
end
|
104
|
+
when Array
|
105
|
+
object.map { |element| _deep_transform_keys_in_object(element, &block) }
|
106
|
+
else
|
107
|
+
object
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
69
111
|
end
|
70
112
|
|
71
113
|
#
|
@@ -10,6 +10,7 @@ module SidekiqUniqueJobs
|
|
10
10
|
# Adds timeout, expiration, lock_args, lock_prefix and lock_digest to the sidekiq job hash
|
11
11
|
# @return [Hash] the job hash
|
12
12
|
def prepare(item)
|
13
|
+
stringify_on_conflict_hash(item)
|
13
14
|
add_lock_timeout(item)
|
14
15
|
add_lock_ttl(item)
|
15
16
|
add_digest(item)
|
@@ -27,6 +28,13 @@ module SidekiqUniqueJobs
|
|
27
28
|
|
28
29
|
private
|
29
30
|
|
31
|
+
def stringify_on_conflict_hash(item)
|
32
|
+
on_conflict = item[ON_CONFLICT]
|
33
|
+
return unless on_conflict.is_a?(Hash)
|
34
|
+
|
35
|
+
item[ON_CONFLICT] = on_conflict.deep_stringify_keys
|
36
|
+
end
|
37
|
+
|
30
38
|
def add_lock_ttl(item)
|
31
39
|
item[LOCK_TTL] = SidekiqUniqueJobs::LockTTL.calculate(item)
|
32
40
|
end
|
@@ -53,7 +53,7 @@ module SidekiqUniqueJobs
|
|
53
53
|
# @return [LockConfig]
|
54
54
|
#
|
55
55
|
def self.from_worker(options)
|
56
|
-
new(options.
|
56
|
+
new(options.deep_stringify_keys)
|
57
57
|
end
|
58
58
|
|
59
59
|
def initialize(job_hash = {})
|
@@ -107,13 +107,13 @@ module SidekiqUniqueJobs
|
|
107
107
|
|
108
108
|
# the strategy to use as conflict resolution from sidekiq client
|
109
109
|
def on_client_conflict
|
110
|
-
@on_client_conflict ||= on_conflict[
|
110
|
+
@on_client_conflict ||= on_conflict["client"] if on_conflict.is_a?(Hash)
|
111
111
|
@on_client_conflict ||= on_conflict
|
112
112
|
end
|
113
113
|
|
114
114
|
# the strategy to use as conflict resolution from sidekiq server
|
115
115
|
def on_server_conflict
|
116
|
-
@on_server_conflict ||= on_conflict[
|
116
|
+
@on_server_conflict ||= on_conflict["server"] if on_conflict.is_a?(Hash)
|
117
117
|
@on_server_conflict ||= on_conflict
|
118
118
|
end
|
119
119
|
end
|
@@ -50,13 +50,13 @@ module SidekiqUniqueJobs
|
|
50
50
|
|
51
51
|
#
|
52
52
|
# The configured default_lock_timeout
|
53
|
-
# @see SidekiqUniqueJobs::Config#
|
53
|
+
# @see SidekiqUniqueJobs::Config#lock_timeout
|
54
54
|
#
|
55
55
|
#
|
56
56
|
# @return [Integer, nil]
|
57
57
|
#
|
58
58
|
def default_lock_timeout
|
59
|
-
SidekiqUniqueJobs.config.
|
59
|
+
SidekiqUniqueJobs.config.lock_timeout
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -11,7 +11,7 @@ module SidekiqUniqueJobs
|
|
11
11
|
|
12
12
|
#
|
13
13
|
# Computes lock ttl from job arguments, sidekiq_options.
|
14
|
-
# Falls back to {
|
14
|
+
# Falls back to {SidekiqUniqueJobs::Config#lock_ttl}
|
15
15
|
#
|
16
16
|
# @note this method takes into consideration the time
|
17
17
|
# until a job is scheduled
|
@@ -57,7 +57,7 @@ module SidekiqUniqueJobs
|
|
57
57
|
|
58
58
|
#
|
59
59
|
# Computes lock ttl from job arguments, sidekiq_options.
|
60
|
-
# Falls back to {
|
60
|
+
# Falls back to {SidekiqUniqueJobs::Config#lock_ttl}
|
61
61
|
#
|
62
62
|
# @note this method takes into consideration the time
|
63
63
|
# until a job is scheduled
|
@@ -70,19 +70,8 @@ module SidekiqUniqueJobs
|
|
70
70
|
ttl ||= worker_options[LOCK_TTL]
|
71
71
|
ttl ||= item[LOCK_EXPIRATION] # TODO: Deprecate at some point
|
72
72
|
ttl ||= worker_options[LOCK_EXPIRATION] # TODO: Deprecate at some point
|
73
|
-
ttl ||=
|
73
|
+
ttl ||= SidekiqUniqueJobs.config.lock_ttl
|
74
74
|
ttl && ttl.to_i + time_until_scheduled
|
75
75
|
end
|
76
|
-
|
77
|
-
#
|
78
|
-
# The configured default_lock_ttl
|
79
|
-
# @see SidekiqUniqueJobs::Config#default_lock_ttl
|
80
|
-
#
|
81
|
-
#
|
82
|
-
# @return [Integer, nil]
|
83
|
-
#
|
84
|
-
def default_lock_ttl
|
85
|
-
SidekiqUniqueJobs.config.default_lock_ttl
|
86
|
-
end
|
87
76
|
end
|
88
77
|
end
|
@@ -10,6 +10,8 @@ module SidekiqUniqueJobs
|
|
10
10
|
module Manager
|
11
11
|
module_function
|
12
12
|
|
13
|
+
DRIFT_FACTOR = 0.02
|
14
|
+
|
13
15
|
include SidekiqUniqueJobs::Connection
|
14
16
|
include SidekiqUniqueJobs::Logging
|
15
17
|
|
@@ -56,6 +58,7 @@ module SidekiqUniqueJobs
|
|
56
58
|
@task ||= Concurrent::TimerTask.new(timer_task_options) do
|
57
59
|
with_logging_context do
|
58
60
|
redis do |conn|
|
61
|
+
refresh_reaper_mutex
|
59
62
|
Orphans::Reaper.call(conn)
|
60
63
|
end
|
61
64
|
end
|
@@ -117,7 +120,9 @@ module SidekiqUniqueJobs
|
|
117
120
|
# @return [true, false]
|
118
121
|
#
|
119
122
|
def registered?
|
120
|
-
redis
|
123
|
+
redis do |conn|
|
124
|
+
conn.get(UNIQUE_REAPER).to_i + drift_reaper_interval > current_timestamp
|
125
|
+
end
|
121
126
|
end
|
122
127
|
|
123
128
|
def disabled?
|
@@ -131,7 +136,17 @@ module SidekiqUniqueJobs
|
|
131
136
|
# @return [void]
|
132
137
|
#
|
133
138
|
def register_reaper_process
|
134
|
-
redis { |conn| conn.set(UNIQUE_REAPER,
|
139
|
+
redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, nx: true, ex: drift_reaper_interval) }
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# Updates mutex key
|
144
|
+
#
|
145
|
+
#
|
146
|
+
# @return [void]
|
147
|
+
#
|
148
|
+
def refresh_reaper_mutex
|
149
|
+
redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, ex: drift_reaper_interval) }
|
135
150
|
end
|
136
151
|
|
137
152
|
#
|
@@ -143,6 +158,14 @@ module SidekiqUniqueJobs
|
|
143
158
|
def unregister_reaper_process
|
144
159
|
redis { |conn| conn.del(UNIQUE_REAPER) }
|
145
160
|
end
|
161
|
+
|
162
|
+
def drift_reaper_interval
|
163
|
+
reaper_interval + (reaper_interval * DRIFT_FACTOR).to_i
|
164
|
+
end
|
165
|
+
|
166
|
+
def current_timestamp
|
167
|
+
Time.now.to_i
|
168
|
+
end
|
146
169
|
end
|
147
170
|
end
|
148
171
|
end
|
@@ -165,7 +165,8 @@ module SidekiqUniqueJobs
|
|
165
165
|
#
|
166
166
|
# This is usually called once at startup of an application
|
167
167
|
# @param [Hash] options global gem options
|
168
|
-
# @option options [Integer] :
|
168
|
+
# @option options [Integer] :lock_timeout (default is 0)
|
169
|
+
# @option options [Integer] :lock_ttl (default is 0)
|
169
170
|
# @option options [true,false] :enabled (default is true)
|
170
171
|
# @option options [String] :unique_prefix (default is 'uniquejobs')
|
171
172
|
# @option options [Logger] :logger (default is Sidekiq.logger)
|
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.beta20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brpoplpush-redis_script
|
@@ -365,7 +365,18 @@ metadata:
|
|
365
365
|
documentation_uri: https://mhenrixon.github.io/sidekiq-unique-jobs
|
366
366
|
source_code_uri: https://github.com/mhenrixon/sidekiq-unique-jobs
|
367
367
|
changelog_uri: https://github.com/mhenrixon/sidekiq-unique-jobs/CHANGELOG.md
|
368
|
-
post_install_message:
|
368
|
+
post_install_message: |
|
369
|
+
This version deprecated the configuration options:
|
370
|
+
- default_lock_ttl
|
371
|
+
- default_lock_ttl=
|
372
|
+
- default_lock_timeout
|
373
|
+
- default_lock_timeout=
|
374
|
+
|
375
|
+
The new methods to use are:
|
376
|
+
- lock_ttl
|
377
|
+
- lock_ttl=
|
378
|
+
- lock_timeout
|
379
|
+
- lock_timeout=
|
369
380
|
rdoc_options: []
|
370
381
|
require_paths:
|
371
382
|
- lib
|