sidekiq-unique-jobs 6.0.3 → 6.0.4

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: e13fe0c30a750cead8f45300cdbe03caa9764e8c84064e411b05fb5eebc34f47
4
- data.tar.gz: 8511c7d945ffad30aade383c8b79090f2fdc05f8d0e69673f0fbefd9a8ac6409
3
+ metadata.gz: f480135b8130f95ced00fab090bb07edc61c9b934dcea18f7fa3460cd9ad08d6
4
+ data.tar.gz: b88008341a02d7c7160c9ecba794e9a2600a17ceef34ae1e403e81b435ef17cb
5
5
  SHA512:
6
- metadata.gz: 152c64c9c6e200677efda852adf0db068c1f39031d9975da0d339710ed6d94d78e434960d95a9417df70c859103c8036f9c35f90c3f07973c04ef958c814a8dc
7
- data.tar.gz: b9823df969b1432395c29f88ebeb88cc20cea8af6dee1f9364c60574565204c68e63e4fedf0d1a3409f74ab2688aaa9426ab8a2581cdd2ef8962ce0a10a37d45
6
+ metadata.gz: a7e120a84552f62bedefbdba9559552fbd546d18369daa4475f0fb2bd43986c45fe47e94d66c0800d78480f499ed653222bbc1c445c5ed6f4f079604f2172ca2
7
+ data.tar.gz: 86b90d16ec677f5a1c7807dbfb3ef3288579368420e109499c2b212ee656f54a62c47bab3dd6ad41ece738cbf0051591cea913ec2e34a501aa2209c8d2f689ed
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v6.0.4
2
+
3
+ - Prevent locks from stealing each other (#316)
4
+
5
+ ## v6.0.3
6
+
7
+ - Fixes a few hickups (#315)
8
+
1
9
  ## v6.0.2
2
10
 
3
11
  - Fixes sidekiq web pagination of unique digests
@@ -32,7 +32,6 @@ module SidekiqUniqueJobs
32
32
  keys: [exists_key, grabbed_key, available_key, version_key, UNIQUE_SET, unique_digest],
33
33
  argv: [jid, expiration, API_VERSION, concurrency],
34
34
  )
35
- expire
36
35
  end
37
36
 
38
37
  def expire
@@ -40,7 +39,7 @@ module SidekiqUniqueJobs
40
39
  :expire,
41
40
  redis_pool,
42
41
  keys: [exists_key, available_key, version_key],
43
- argv: [expiration],
42
+ argv: [expiration, jid],
44
43
  )
45
44
  end
46
45
 
@@ -82,6 +81,7 @@ module SidekiqUniqueJobs
82
81
  create
83
82
 
84
83
  grab_token(timeout) do |token|
84
+ expire
85
85
  touch_grabbed_token(token)
86
86
  return_token_or_block_value(token, &block)
87
87
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqUniqueJobs
4
- VERSION = '6.0.3'
4
+ VERSION = '6.0.4'
5
5
  end
data/redis/create.lua CHANGED
@@ -12,11 +12,16 @@ local expiration = tonumber(ARGV[2])
12
12
  local api_version = ARGV[3]
13
13
  local concurrency = tonumber(ARGV[4])
14
14
 
15
- local stored_token = redis.call('GETSET', exists_key, job_id)
16
- if stored_token then
15
+ -- redis.log(redis.LOG_DEBUG, "create.lua - investigate possibility of locking jid: " .. job_id)
16
+
17
+ local stored_token = redis.call('GET', exists_key)
18
+ if stored_token and stored_token ~= job_id then
19
+ -- redis.log(redis.LOG_DEBUG, "create.lua - jid: " .. job_id .. " - returning existing jid: " .. stored_token)
17
20
  return stored_token
18
21
  end
19
22
 
23
+ redis.call('SET', exists_key, job_id)
24
+
20
25
  ----------------------------------------------------------------
21
26
  -- TODO: Legacy support (Remove in v6.1)
22
27
  local old_token = redis.call('GET', unique_digest)
@@ -30,6 +35,7 @@ if old_token then
30
35
  end
31
36
  ----------------------------------------------------------------
32
37
 
38
+ -- redis.log(redis.LOG_DEBUG, "create.lua - creating locks for jid: " .. job_id)
33
39
  redis.call('SADD', unique_keys, unique_digest)
34
40
  redis.call('EXPIRE', exists_key, 5)
35
41
  redis.call('DEL', grabbed_key)
@@ -42,7 +48,11 @@ if concurrency and concurrency > 1 then
42
48
  else
43
49
  redis.call('RPUSH', available_key, job_id)
44
50
  end
45
- redis.call('GETSET', version_key, api_version)
51
+
52
+ -- redis.log(redis.LOG_DEBUG, "create.lua - persisting locks for jid: " .. job_id)
46
53
  redis.call('PERSIST', exists_key)
47
54
 
55
+ redis.call('GETSET', version_key, api_version)
56
+
57
+
48
58
  return job_id
data/redis/expire.lua CHANGED
@@ -5,9 +5,10 @@ local available_key = KEYS[2]
5
5
  local version_key = KEYS[3]
6
6
 
7
7
  local expiration = tonumber(ARGV[1])
8
+ local job_id = ARGV[2]
8
9
 
9
10
  if expiration then
10
- redis.log(redis.LOG_DEBUG, "create.lua - expiring locks because expiration: " .. tostring(expiration))
11
+ -- redis.log(redis.LOG_DEBUG, "expire.lua - expiring locks for job_id: " .. job_id)
11
12
  redis.call('EXPIRE', available_key, expiration)
12
13
  redis.call('EXPIRE', exists_key, expiration)
13
14
  redis.call('EXPIRE', version_key, expiration)
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: 6.0.3
4
+ version: 6.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson