sidekiq-unique-jobs 7.0.0.beta11 → 7.0.0.beta12

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: 0e4b1d2afbe4126de1f3218b2b386bcd10fe9533b354a5694f6a419e2f4e8e3f
4
- data.tar.gz: 46b8bc4b55ddaa883d06c31696e3e515bfe8d5094faaeeb4200f8a53983ba7dc
3
+ metadata.gz: 5099888d19251ef2ee0edc4cf6918d060faaeb3abc949b13bfb959f55dfdbb86
4
+ data.tar.gz: 92114bd7aa7b7d2834e683aca81fdf58ad7e9b6b4b73717101eae406fcc80f4f
5
5
  SHA512:
6
- metadata.gz: 3ae95fa750d1775b5ed0b244a97b56539a20e3938eec6f9d9d45111d9017e78af0923bfe2683328bec63875f0fc89437bd28ddfce577db558f95a73257065506
7
- data.tar.gz: 1535795137ca8836f2e62fb737503e82d9a4315e77d90e249e9b16979ced0d50cb8fc22e1d5f184b009d51c073490db81bce940e10b4ca9f343ab95d68fd5efa
6
+ metadata.gz: 42ecd0377617197773d37bd233191ec47bb4942338107f3251154b47d1148a60d963c722168dc4fd07af533886875383bc890376bbf4750ef39f2d94df66df90
7
+ data.tar.gz: 3b4805fb012f2b0a12633e63136b5a0759afd67556865d2ca358e3a05715d75aa543ab2f8c5aa940c433ba44c02188e96e9718f710f5fe4b8dca62bf73d2c1ea
@@ -1,5 +1,38 @@
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/v6.0.20...HEAD)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - until\_expired is not setting TTL [\#468](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/468)
10
+
11
+ ## [v6.0.20](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v6.0.20) (2020-03-22)
12
+
13
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta11...v6.0.20)
14
+
15
+ **Fixed bugs:**
16
+
17
+ - Deletion of digest doesn't work from admin UI [\#438](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/438)
18
+
19
+ **Closed issues:**
20
+
21
+ - Please keep some recent versions on rubygems.org [\#478](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/478)
22
+ - validate\_worker! throws error [\#466](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/466)
23
+
24
+ **Merged pull requests:**
25
+
26
+ - Allow v7 configuration to work [\#479](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/479) ([mhenrixon](https://github.com/mhenrixon))
27
+
28
+ ## [v7.0.0.beta11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta11) (2020-03-21)
29
+
30
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta10...v7.0.0.beta11)
31
+
32
+ **Fixed bugs:**
33
+
34
+ - Only configure RSpec when constant is defined [\#477](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/477) ([mhenrixon](https://github.com/mhenrixon))
35
+
3
36
  ## [v7.0.0.beta10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta10) (2020-03-21)
4
37
 
5
38
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v6.0.19...v7.0.0.beta10)
@@ -8,6 +8,7 @@ local changelog = KEYS[6]
8
8
  local digests = KEYS[7]
9
9
  -------- END keys ---------
10
10
 
11
+
11
12
  -------- BEGIN lock arguments ---------
12
13
  local job_id = ARGV[1]
13
14
  local pttl = tonumber(ARGV[2])
@@ -15,6 +16,7 @@ local lock_type = ARGV[3]
15
16
  local limit = tonumber(ARGV[4])
16
17
  -------- END lock arguments -----------
17
18
 
19
+
18
20
  -------- BEGIN injected arguments --------
19
21
  local current_time = tonumber(ARGV[5])
20
22
  local debug_lua = ARGV[6] == "true"
@@ -23,6 +25,7 @@ local script_name = tostring(ARGV[8]) .. ".lua"
23
25
  local redisversion = ARGV[9]
24
26
  --------- END injected arguments ---------
25
27
 
28
+
26
29
  -------- BEGIN local functions --------
27
30
  <%= include_partial "shared/_common.lua" %>
28
31
  ---------- END local functions ----------
@@ -68,7 +71,7 @@ redis.call("LREM", primed, 1, job_id)
68
71
 
69
72
  -- The Sidekiq client should only set pttl for until_expired
70
73
  -- The Sidekiq server should set pttl for all other jobs
71
- if lock_type == "until_expired" and pttl and pttl > 0 then
74
+ if pttl and pttl > 0 then
72
75
  log_debug("PEXPIRE", digest, pttl)
73
76
  redis.call("PEXPIRE", digest, pttl)
74
77
 
@@ -8,13 +8,15 @@ local changelog = KEYS[6]
8
8
  local digests = KEYS[7]
9
9
  -------- END keys ---------
10
10
 
11
+
11
12
  -------- BEGIN lock arguments ---------
12
- local job_id = ARGV[1] -- The job_id that was previously primed
13
- local pttl = tonumber(ARGV[2])
14
- local lock_type = ARGV[3]
15
- local limit = tonumber(ARGV[4])
13
+ local job_id = ARGV[1] -- The job_id that was previously primed
14
+ local pttl = tonumber(ARGV[2])
15
+ local lock_type = ARGV[3]
16
+ local limit = tonumber(ARGV[4])
16
17
  -------- END lock arguments -----------
17
18
 
19
+
18
20
  -------- BEGIN injected arguments --------
19
21
  local current_time = tonumber(ARGV[5])
20
22
  local debug_lua = ARGV[6] == "true"
@@ -22,6 +24,7 @@ local max_history = tonumber(ARGV[7])
22
24
  local script_name = tostring(ARGV[8]) .. ".lua"
23
25
  --------- END injected arguments ---------
24
26
 
27
+
25
28
  -------- BEGIN Variables --------
26
29
  local queued_count = redis.call("LLEN", queued)
27
30
  local locked_count = redis.call("HLEN", locked)
@@ -29,6 +32,7 @@ local within_limit = limit > locked_count
29
32
  local limit_exceeded = not within_limit
30
33
  -------- END Variables --------
31
34
 
35
+
32
36
  -------- BEGIN local functions --------
33
37
  <%= include_partial "shared/_common.lua" %>
34
38
  ---------- END local functions ----------
@@ -70,7 +74,7 @@ redis.call("LPUSH", queued, job_id)
70
74
 
71
75
  -- The Sidekiq client should only set pttl for until_expired
72
76
  -- The Sidekiq server should set pttl for all other jobs
73
- if lock_type == "until_expired" and pttl > 0 then
77
+ if pttl and pttl > 0 then
74
78
  log_debug("PEXPIRE", digest, pttl)
75
79
  redis.call("PEXPIRE", digest, pttl)
76
80
  log_debug("PEXPIRE", queued, pttl)
@@ -8,13 +8,15 @@ local changelog = KEYS[6]
8
8
  local digests = KEYS[7]
9
9
  -------- END keys ---------
10
10
 
11
+
11
12
  -------- BEGIN lock arguments ---------
12
- local job_id = ARGV[1]
13
- local pttl = tonumber(ARGV[2])
14
- local type = ARGV[3]
15
- local limit = tonumber(ARGV[4])
13
+ local job_id = ARGV[1]
14
+ local pttl = tonumber(ARGV[2])
15
+ local lock_type = ARGV[3]
16
+ local limit = tonumber(ARGV[4])
16
17
  -------- END lock arguments -----------
17
18
 
19
+
18
20
  -------- BEGIN injected arguments --------
19
21
  local current_time = tonumber(ARGV[5])
20
22
  local debug_lua = ARGV[6] == "true"
@@ -23,12 +25,14 @@ local script_name = tostring(ARGV[8]) .. ".lua"
23
25
  local redisversion = ARGV[9]
24
26
  --------- END injected arguments ---------
25
27
 
28
+
26
29
  -------- BEGIN Variables --------
27
30
  local queued_count = redis.call("LLEN", queued)
28
31
  local primed_count = redis.call("LLEN", primed)
29
32
  local locked_count = redis.call("HLEN", locked)
30
33
  --------- END Variables ---------
31
34
 
35
+
32
36
  -------- BEGIN local functions --------
33
37
  <%= include_partial "shared/_common.lua" %>
34
38
  ---------- END local functions ----------
@@ -65,21 +69,12 @@ redis.call("LREM", primed, -1, job_id)
65
69
  log_debug("ZREM", digests, digest)
66
70
  redis.call("ZREM", digests, digest)
67
71
 
68
- if pttl and pttl > 0 then
69
- log_debug("PEXPIRE", digest, pttl)
70
- redis.call("PEXPIRE", digest, pttl)
71
-
72
- log_debug("PEXPIRE", locked, pttl)
73
- redis.call("PEXPIRE", locked, pttl)
74
-
75
- log_debug("PEXPIRE", info, pttl)
76
- redis.call("PEXPIRE", info, pttl)
77
- else
78
- local redis_version = toversion(redisversion)
79
- local del_cmd = "DEL"
72
+ local redis_version = toversion(redisversion)
73
+ local del_cmd = "DEL"
80
74
 
81
- if tonumber(redis_version["major"]) >= 4 then del_cmd = "UNLINK"; end
75
+ if tonumber(redis_version["major"]) >= 4 then del_cmd = "UNLINK"; end
82
76
 
77
+ if lock_type ~= "until_expired" then
83
78
  log_debug(del_cmd, digest, info)
84
79
  redis.call(del_cmd, digest, info)
85
80
 
@@ -90,8 +85,8 @@ end
90
85
  log_debug("LPUSH", queued, "1")
91
86
  redis.call("LPUSH", queued, "1")
92
87
 
93
- log_debug("PEXPIRE", queued, 500)
94
- redis.call("PEXPIRE", queued, 500)
88
+ log_debug("PEXPIRE", queued, 5000)
89
+ redis.call("PEXPIRE", queued, 5000)
95
90
 
96
91
  log("Unlocked")
97
92
  log_debug("END unlock digest:", digest, "(job_id: " .. job_id ..")")
@@ -11,6 +11,13 @@ module SidekiqUniqueJobs
11
11
  # Unlocks a job.
12
12
  # @param [Hash] item a Sidekiq job hash
13
13
  def unlock(item)
14
+ SidekiqUniqueJobs::Job.add_digest(item)
15
+ SidekiqUniqueJobs::Locksmith.new(item).unlock
16
+ end
17
+
18
+ # Unlocks a job.
19
+ # @param [Hash] item a Sidekiq job hash
20
+ def unlock!(item)
14
21
  SidekiqUniqueJobs::Job.add_digest(item)
15
22
  SidekiqUniqueJobs::Locksmith.new(item).unlock!
16
23
  end
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.0.0.beta11"
6
+ VERSION = "7.0.0.beta12"
7
7
  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.beta11
4
+ version: 7.0.0.beta12
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-03-21 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brpoplpush-redis_script
@@ -176,72 +176,72 @@ dependencies:
176
176
  name: timecop
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - ">="
179
+ - - "~>"
180
180
  - !ruby/object:Gem::Version
181
- version: '0'
181
+ version: '0.9'
182
182
  type: :development
183
183
  prerelease: false
184
184
  version_requirements: !ruby/object:Gem::Requirement
185
185
  requirements:
186
- - - ">="
186
+ - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: '0'
188
+ version: '0.9'
189
189
  - !ruby/object:Gem::Dependency
190
190
  name: github-markup
191
191
  requirement: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - ">="
193
+ - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: '0'
195
+ version: '3.0'
196
196
  type: :development
197
197
  prerelease: false
198
198
  version_requirements: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - ">="
200
+ - - "~>"
201
201
  - !ruby/object:Gem::Version
202
- version: '0'
202
+ version: '3.0'
203
203
  - !ruby/object:Gem::Dependency
204
204
  name: github_changelog_generator
205
205
  requirement: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - ">="
207
+ - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '0'
209
+ version: '1.14'
210
210
  type: :development
211
211
  prerelease: false
212
212
  version_requirements: !ruby/object:Gem::Requirement
213
213
  requirements:
214
- - - ">="
214
+ - - "~>"
215
215
  - !ruby/object:Gem::Version
216
- version: '0'
216
+ version: '1.14'
217
217
  - !ruby/object:Gem::Dependency
218
218
  name: yard
219
219
  requirement: !ruby/object:Gem::Requirement
220
220
  requirements:
221
- - - ">="
221
+ - - "~>"
222
222
  - !ruby/object:Gem::Version
223
- version: '0'
223
+ version: 0.9.18
224
224
  type: :development
225
225
  prerelease: false
226
226
  version_requirements: !ruby/object:Gem::Requirement
227
227
  requirements:
228
- - - ">="
228
+ - - "~>"
229
229
  - !ruby/object:Gem::Version
230
- version: '0'
230
+ version: 0.9.18
231
231
  - !ruby/object:Gem::Dependency
232
232
  name: gem-release
233
233
  requirement: !ruby/object:Gem::Requirement
234
234
  requirements:
235
- - - ">="
235
+ - - "~>"
236
236
  - !ruby/object:Gem::Version
237
- version: '0'
237
+ version: '2.0'
238
238
  type: :development
239
239
  prerelease: false
240
240
  version_requirements: !ruby/object:Gem::Requirement
241
241
  requirements:
242
- - - ">="
242
+ - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: '0'
244
+ version: '2.0'
245
245
  description: |
246
246
  Prevents simultaneous Sidekiq jobs with the same unique arguments to run.
247
247
  Highly configurable to suite your specific needs.