sidekiq-unique-jobs 7.0.0.beta15 → 7.0.0.beta16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sidekiq-unique-jobs might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -8
- data/lib/sidekiq_unique_jobs/config.rb +24 -2
- data/lib/sidekiq_unique_jobs/core_ext.rb +42 -0
- 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/sidekiq_unique_jobs.rb +2 -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: f290b8f99626c55f5152ecf2c15dc6776dda2090f8b1f848aefad2a08fc693b2
|
4
|
+
data.tar.gz: '08e56acded9b53d7653ea4af16dd8bd767096532c72f0f1c085c14e4ffabb4b6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648e4bf89e3e4170cba81fe7bcdb68f7d15b8359dff1b0843dd5c38b0426628a4d5472f389d4f3df227a32f1cbfc8c32bc599eadfc8beca9ad4bbba27a72cab6
|
7
|
+
data.tar.gz: 19a9189c6e31d870528a2995a622cf1b41c681ec12315754fa704aee1f38f1b28c8ba9a31999598c9dfa0ae531f9866ab089b3d4708c850f0ed4341c0773a957
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v7.0.0.beta15](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta15) (2020-04-10)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta14...v7.0.0.beta15)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Duplicated scripts [\#492](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/492)
|
10
|
+
- CI: Use jruby-9.2.11.1 [\#485](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/485) ([olleolleolle](https://github.com/olleolleolle))
|
11
|
+
|
12
|
+
**Fixed bugs:**
|
13
|
+
|
14
|
+
- V7 - `on\_conflict:` no longer accepts a Hash [\#495](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/495)
|
15
|
+
- Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
|
16
|
+
- Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
|
17
|
+
- Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
|
18
|
+
- Fix access to hash members [\#496](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/496) ([mhenrixon](https://github.com/mhenrixon))
|
19
|
+
- Fix cursor assignment [\#494](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/494) ([mhenrixon](https://github.com/mhenrixon))
|
20
|
+
- Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
|
21
|
+
|
3
22
|
## [v7.0.0.beta14](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta14) (2020-03-30)
|
4
23
|
|
5
24
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.21...v7.0.0.beta14)
|
@@ -133,6 +152,11 @@
|
|
133
152
|
|
134
153
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.18...v7.0.0.beta6)
|
135
154
|
|
155
|
+
**Implemented enhancements:**
|
156
|
+
|
157
|
+
- Clarify usage with global\_id and sidekiq-status [\#455](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/455) ([mhenrixon](https://github.com/mhenrixon))
|
158
|
+
- Bump rails [\#450](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/450) ([mhenrixon](https://github.com/mhenrixon))
|
159
|
+
|
136
160
|
**Merged pull requests:**
|
137
161
|
|
138
162
|
- Fix that Sidekiq now sends instance of worker [\#459](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/459) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -157,7 +181,6 @@
|
|
157
181
|
|
158
182
|
**Implemented enhancements:**
|
159
183
|
|
160
|
-
- Bump rails [\#450](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/450) ([mhenrixon](https://github.com/mhenrixon))
|
161
184
|
- Rename myapp [\#449](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/449) ([mhenrixon](https://github.com/mhenrixon))
|
162
185
|
- Just to keep track of this [\#445](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/445) ([mhenrixon](https://github.com/mhenrixon))
|
163
186
|
|
@@ -175,10 +198,6 @@
|
|
175
198
|
|
176
199
|
[Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.16...v6.0.17)
|
177
200
|
|
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
201
|
**Fixed bugs:**
|
183
202
|
|
184
203
|
- Allow redis namespace to work with deletion [\#451](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/451) ([mhenrixon](https://github.com/mhenrixon))
|
@@ -473,7 +492,7 @@
|
|
473
492
|
**Fixed bugs:**
|
474
493
|
|
475
494
|
- Enable replace strategy [\#315](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/315) ([mhenrixon](https://github.com/mhenrixon))
|
476
|
-
-
|
495
|
+
- Bug fixes [\#310](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/310) ([mhenrixon](https://github.com/mhenrixon))
|
477
496
|
|
478
497
|
**Closed issues:**
|
479
498
|
|
@@ -490,7 +509,6 @@
|
|
490
509
|
**Fixed bugs:**
|
491
510
|
|
492
511
|
- Not unlocking automatically \(version 6.0.0rc5\) [\#293](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/293)
|
493
|
-
- Bug fixes [\#310](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/310) ([mhenrixon](https://github.com/mhenrixon))
|
494
512
|
|
495
513
|
## [v6.0.1](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.1) (2018-07-31)
|
496
514
|
|
@@ -499,6 +517,7 @@
|
|
499
517
|
**Fixed bugs:**
|
500
518
|
|
501
519
|
- :until\_executed is throwing errors and not requeuing the job. [\#256](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/256)
|
520
|
+
- Remove unused method [\#307](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/307) ([mhenrixon](https://github.com/mhenrixon))
|
502
521
|
|
503
522
|
**Closed issues:**
|
504
523
|
|
@@ -840,6 +859,7 @@
|
|
840
859
|
- missed space [\#188](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/188) ([TheBigSadowski](https://github.com/TheBigSadowski))
|
841
860
|
- Convert unless if to just 1 if [\#179](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/179) ([otzy007](https://github.com/otzy007))
|
842
861
|
- 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))
|
862
|
+
- Fixed gitter badge link [\#176](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/176) ([andrew](https://github.com/andrew))
|
843
863
|
|
844
864
|
## [v4.0.17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.17) (2016-03-02)
|
845
865
|
|
@@ -855,7 +875,6 @@
|
|
855
875
|
|
856
876
|
**Merged pull requests:**
|
857
877
|
|
858
|
-
- Fixed gitter badge link [\#176](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/176) ([andrew](https://github.com/andrew))
|
859
878
|
- 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
879
|
- Run lock timeout configurable [\#164](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/164) ([Slania](https://github.com/Slania))
|
861
880
|
|
@@ -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,26 @@ module SidekiqUniqueJobs
|
|
183
184
|
)
|
184
185
|
end
|
185
186
|
|
187
|
+
def default_lock_ttl=(obj)
|
188
|
+
warn "[DEPRECATION] `#{self.class}##{__method__}` is deprecated. Please use `#{self.class}#lock_ttl=` instead."
|
189
|
+
self.lock_ttl = obj
|
190
|
+
end
|
191
|
+
|
192
|
+
def default_lock_timeout=(obj)
|
193
|
+
warn "[DEPRECATION] `#{self.class}##{__method__}` is deprecated. Please use `#{self.class}#lock_timeout=` instead."
|
194
|
+
self.lock_timeout = obj
|
195
|
+
end
|
196
|
+
|
197
|
+
def default_lock_ttl
|
198
|
+
warn "[DEPRECATION] `#{self.class}##{__method__}` is deprecated. Please use `#{self.class}#lock_ttl` instead."
|
199
|
+
lock_ttl
|
200
|
+
end
|
201
|
+
|
202
|
+
def default_lock_timeout
|
203
|
+
warn "[DEPRECATION] `#{self.class}##{__method__}` is deprecated. Please use `#{self.class}#lock_timeout` instead."
|
204
|
+
lock_timeout
|
205
|
+
end
|
206
|
+
|
186
207
|
#
|
187
208
|
# Adds a lock type to the configuration. It will raise if the lock exists already
|
188
209
|
#
|
@@ -234,4 +255,5 @@ module SidekiqUniqueJobs
|
|
234
255
|
current_redis_version
|
235
256
|
end
|
236
257
|
end
|
258
|
+
# rubocop:enable Metrics/ClassLength
|
237
259
|
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 { |e| _deep_transform_keys_in_object(e, &block) }
|
106
|
+
else
|
107
|
+
object
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
69
111
|
end
|
70
112
|
|
71
113
|
#
|
@@ -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
|
@@ -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.beta16
|
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-05-19 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
|