sidekiq-unique-jobs 7.0.0.beta21 → 7.0.0.beta22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa60dc35cfa347f88d50dd3b115e0313c88f150368a5052eec648f1e136c4e4e
4
- data.tar.gz: 708a1f4191b7ec2f0a07129ce6abc8528908c2289c66cf55e9142c93b661e603
3
+ metadata.gz: '09650d2cec14e6bfeaf6b74b938286eca9ef889275cd3e885b196cca2ffb1f2f'
4
+ data.tar.gz: 613901dec7e012a67d6e6e1289f1d2b0d9f47e6f6d2764eb1618d2ec389879e7
5
5
  SHA512:
6
- metadata.gz: a097632a78d20a8ad3aaaf98819b18274a962965be59e3a0b3d0bd0208c47410dfc98bfd370007b35454d7a2ac3699374244d63fad3f11f549dde16998e542fc
7
- data.tar.gz: beaa24b58dc8844aa689e108d2529f29b1390745df99687ab074e6822dad4cabb72402ae132b32307c4753551b70a5d44d1f0f475a6f64cb39a2405ecb4e9ff2
6
+ metadata.gz: 9a12b9d88451356effaeeebfe24e4f69f964aa53d7c85958fa55da58ae2a6a26482a5865dd78b0fbd6389bceb2936449dfde64a6a1238242ed097c24818b26fe
7
+ data.tar.gz: c4284c65010101466e6e3521a4358633c76337f7a5304040f4d188fae8a56f6af2e6f53350da283c5d45f90c4cb28f60d9768a201e3ddf7f19e7ee0cbfa44ffc
@@ -1,5 +1,31 @@
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.beta21...HEAD)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Infinite loop in ruby reaper [\#515](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/515)
10
+
11
+ ## [v7.0.0.beta21](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta21) (2020-06-12)
12
+
13
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta20...v7.0.0.beta21)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - Move gems to gemfile [\#513](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/513) ([mhenrixon](https://github.com/mhenrixon))
18
+ - Move dev-gems from gemspec to gemfile [\#512](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/512) ([mhenrixon](https://github.com/mhenrixon))
19
+
20
+ **Fixed bugs:**
21
+
22
+ - Prevent indefinitely looping entries [\#516](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/516) ([mhenrixon](https://github.com/mhenrixon))
23
+ - Expire reaper when not checking in [\#508](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/508) ([mhenrixon](https://github.com/mhenrixon))
24
+
25
+ **Closed issues:**
26
+
27
+ - Missing web interface [\#514](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/514)
28
+
3
29
  ## [v7.0.0.beta20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta20) (2020-06-02)
4
30
 
5
31
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta19...v7.0.0.beta20)
@@ -16,18 +42,10 @@
16
42
 
17
43
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta18...v7.0.0.beta19)
18
44
 
19
- **Fixed bugs:**
20
-
21
- - Expire reaper when not checking in [\#508](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/508) ([mhenrixon](https://github.com/mhenrixon))
22
-
23
45
  ## [v7.0.0.beta18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta18) (2020-05-21)
24
46
 
25
47
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta17...v7.0.0.beta18)
26
48
 
27
- **Fixed bugs:**
28
-
29
- - Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
30
-
31
49
  ## [v7.0.0.beta17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta17) (2020-05-20)
32
50
 
33
51
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta16...v7.0.0.beta17)
@@ -36,13 +54,16 @@
36
54
 
37
55
  - Try GitHub actions [\#505](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/505) ([mhenrixon](https://github.com/mhenrixon))
38
56
 
57
+ **Fixed bugs:**
58
+
59
+ - 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))
60
+
39
61
  ## [v7.0.0.beta16](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta16) (2020-05-19)
40
62
 
41
63
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.22...v7.0.0.beta16)
42
64
 
43
65
  **Fixed bugs:**
44
66
 
45
- - 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))
46
67
  - Deprecate configuration options with `default\_` [\#504](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/504) ([mhenrixon](https://github.com/mhenrixon))
47
68
  - Fix access to both server and client conflict [\#503](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/503) ([mhenrixon](https://github.com/mhenrixon))
48
69
 
@@ -73,6 +94,7 @@
73
94
  - Brpoplpush::RedisScript::LuaError: WRONGTYPE Operation against a key holding the wrong kind of value [\#491](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/491)
74
95
  - Lua script bug [\#489](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/489)
75
96
  - Reaper will delete locks for running jobs [\#488](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/488)
97
+ - Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
76
98
  - Fix access to hash members [\#496](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/496) ([mhenrixon](https://github.com/mhenrixon))
77
99
  - Fix cursor assignment [\#494](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/494) ([mhenrixon](https://github.com/mhenrixon))
78
100
  - Prevent reaping of active jobs [\#493](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/493) ([mhenrixon](https://github.com/mhenrixon))
@@ -154,7 +176,6 @@
154
176
  **Merged pull requests:**
155
177
 
156
178
  - README: Use SVG badges ✨ [\#470](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/470) ([olleolleolle](https://github.com/olleolleolle))
157
- - remove deprecated/broken OptionsWithFallback\#unique\_type [\#435](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/435) ([zvkemp](https://github.com/zvkemp))
158
179
 
159
180
  ## [v6.0.19](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.19) (2020-03-21)
160
181
 
@@ -297,6 +318,7 @@
297
318
  **Merged pull requests:**
298
319
 
299
320
  - Fix typo and some formatting issues in README [\#442](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/442) ([ajkerr](https://github.com/ajkerr))
321
+ - remove deprecated/broken OptionsWithFallback\#unique\_type [\#435](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/435) ([zvkemp](https://github.com/zvkemp))
300
322
 
301
323
  ## [v7.0.0.beta2](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta2) (2019-10-08)
302
324
 
@@ -683,7 +705,6 @@
683
705
  - Duplicate jobs getting created [\#257](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/257)
684
706
  - Multiple non-unique jobs with until\_executed? [\#255](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/255)
685
707
  - :until\_executing not unlocking when starting to run [\#245](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/245)
686
- - Drop jobs hash [\#282](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/282) ([mhenrixon](https://github.com/mhenrixon))
687
708
 
688
709
  **Closed issues:**
689
710
 
@@ -726,6 +747,10 @@
726
747
  - Reject while scheduling [\#273](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/273) ([mhenrixon](https://github.com/mhenrixon))
727
748
  - Improve testing [\#272](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/272) ([mhenrixon](https://github.com/mhenrixon))
728
749
 
750
+ **Fixed bugs:**
751
+
752
+ - Drop jobs hash [\#282](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/282) ([mhenrixon](https://github.com/mhenrixon))
753
+
729
754
  ## [v6.0.0.beta](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.0.beta) (2018-06-17)
730
755
 
731
756
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v5.0.10...v6.0.0.beta)
@@ -1134,7 +1159,6 @@
1134
1159
  - mock\_redis and the mess [\#62](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/62)
1135
1160
  - What is the exact behavior? [\#47](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/47)
1136
1161
  - Throttling jobs [\#39](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/39)
1137
- - undefined method `get\_sidekiq\_options' for "MyScheduledWorker":String [\#27](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/27)
1138
1162
  - Crash handling [\#14](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/14)
1139
1163
  - Missing info from README [\#6](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/6)
1140
1164
 
@@ -1231,6 +1255,7 @@
1231
1255
  - Short jobs are not unique for the given time window [\#33](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/33)
1232
1256
  - Not all sidekiq:sidekiq\_unique keys are removed from Redis [\#31](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/31)
1233
1257
  - What does uniqueness mean in case of this gem? [\#30](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/30)
1258
+ - undefined method `get\_sidekiq\_options' for "MyScheduledWorker":String [\#27](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/27)
1234
1259
  - Server middleware removes payload hash key before expiration [\#26](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/26)
1235
1260
  - Lock remains when running with Sidekiq::Testing.inline! [\#23](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/23)
1236
1261
  - What is the use case for the uniqueness window? [\#22](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/22)
@@ -1243,7 +1268,6 @@
1243
1268
  - Clarify README about unique expiration [\#36](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/36) ([spacemunkay](https://github.com/spacemunkay))
1244
1269
  - Add option to make jobs unique on all queues [\#32](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/32) ([robinmessage](https://github.com/robinmessage))
1245
1270
  - Fix homepage in gemspec [\#29](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/29) ([tmaier](https://github.com/tmaier))
1246
- - Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
1247
1271
 
1248
1272
  ## [v2.7.0](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v2.7.0) (2013-11-24)
1249
1273
 
@@ -1262,6 +1286,7 @@
1262
1286
  - Make unlock/yield order configurable. [\#21](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/21) ([endofunky](https://github.com/endofunky))
1263
1287
  - Rely on Sidekiq's String\#constantize extension instead of rolling our own [\#19](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/19) ([disbelief](https://github.com/disbelief))
1264
1288
  - Attempt to constantize String `worker\_class` arguments passed to client middleware [\#17](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/17) ([disbelief](https://github.com/disbelief))
1289
+ - Compatibility with Sidekiq 2.12.1 Scheduled Jobs [\#16](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/16) ([lsimoneau](https://github.com/lsimoneau))
1265
1290
  - Allow worker to specify which arguments to include in uniquing hash [\#12](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/12) ([sax](https://github.com/sax))
1266
1291
  - Add support for unique when using Sidekiq's delay function [\#11](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/11) ([eduardosasso](https://github.com/eduardosasso))
1267
1292
  - Adding the unique prefix option [\#8](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/8) ([KensoDev](https://github.com/KensoDev))
@@ -65,11 +65,7 @@ repeat
65
65
  -- TODO: Add check for jobs checked out by process
66
66
  if found ~= true then
67
67
  log_debug("Searching for digest:", digest, "in process sets")
68
- local queue = find_digest_in_process_set(digest)
69
- if queue then
70
- log_debug("found digest:", digest, "in queue:", queue)
71
- found = true
72
- end
68
+ found = find_digest_in_process_set(digest)
73
69
  end
74
70
 
75
71
  if found ~= true then
@@ -4,7 +4,7 @@ local function find_digest_in_process_set(digest)
4
4
  local pattern = "*" .. digest .. "*"
5
5
  local found = false
6
6
 
7
- log_debug("searching in list processes:",
7
+ log_debug("Searching in process list",
8
8
  "for digest:", digest,
9
9
  "cursor:", process_cursor)
10
10
 
@@ -15,15 +15,26 @@ local function find_digest_in_process_set(digest)
15
15
  log_debug("Found number of processes:", #processes, "next cursor:", next_process_cursor)
16
16
 
17
17
  for _, process in ipairs(processes) do
18
+ local workers_key = process .. ":workers"
18
19
  log_debug("searching in process set:", process,
19
20
  "for digest:", digest,
20
21
  "cursor:", process_cursor)
21
22
 
22
- local job = redis.call("HGET", process, "info")
23
+ local jobs = redis.call("HGETALL", workers_key)
23
24
 
24
- if string.find(job, digest) then
25
- log_debug("Found digest", digest, "in process:", process)
26
- found = true
25
+ if #jobs == 0 then
26
+ log_debug("No entries in:", workers_key)
27
+ else
28
+ for i = 1, #jobs, 2 do
29
+ if string.find(jobs[i +1], digest) then
30
+ log_debug("Found digest", digest, "in:", workers_key)
31
+ found = true
32
+ break
33
+ end
34
+ end
35
+ end
36
+
37
+ if found == true then
27
38
  break
28
39
  end
29
40
  end
@@ -111,7 +111,7 @@ module SidekiqUniqueJobs
111
111
  # @return [String] a JSON formatted string
112
112
  #
113
113
  def payload
114
- @payload ||= Sidekiq.dump_json(item)
114
+ @payload ||= dump_json(item)
115
115
  end
116
116
  end
117
117
  end
@@ -117,17 +117,24 @@ module SidekiqUniqueJobs
117
117
  end
118
118
  end
119
119
 
120
- def active?(digest)
120
+ def active?(digest) # rubocop:disable Metrics/MethodLength
121
121
  Sidekiq.redis do |conn|
122
- procs = conn.sscan_each("processes").to_a.sort
122
+ procs = conn.sscan_each("processes").to_a
123
+ return false if procs.empty?
123
124
 
124
- result = conn.pipelined do
125
- procs.map do |key|
126
- conn.hget(key, "info")
125
+ procs.sort.each do |key|
126
+ valid, workers = conn.pipelined do
127
+ conn.exists(key)
128
+ conn.hgetall("#{key}:workers")
127
129
  end
128
- end
129
130
 
130
- result.flatten.compact.any? { |job| load_json(job)[LOCK_DIGEST] == digest }
131
+ next unless valid
132
+ next unless workers.any?
133
+
134
+ workers.each_pair do |_tid, job|
135
+ return true if load_json(job)[LOCK_DIGEST] == digest
136
+ end
137
+ end
131
138
  end
132
139
  end
133
140
 
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.0.0.beta21"
6
+ VERSION = "7.0.0.beta22"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-unique-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0.beta21
4
+ version: 7.0.0.beta22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson