sidekiq-unique-jobs 6.0.2 → 6.0.3

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: bc7f82e3d04720a79501ea98300940be276d16484b840fcb29cbde5d9b02d4d0
4
- data.tar.gz: 2c591c1695107e8afb57dc7ba67451ddcd28518251ce0515ec6fb032ae558975
3
+ metadata.gz: e13fe0c30a750cead8f45300cdbe03caa9764e8c84064e411b05fb5eebc34f47
4
+ data.tar.gz: 8511c7d945ffad30aade383c8b79090f2fdc05f8d0e69673f0fbefd9a8ac6409
5
5
  SHA512:
6
- metadata.gz: 1b27618d4859b77a8960bc8779e9d62a39c856b58fc6d3cabf3b6650c2021f1288b41224a81fe4c5339a42fb7e20ec02b64f4455fdf2b3e250529aec436b4c51
7
- data.tar.gz: 0aab133cbd5ae5ca3b16af1c5995a32cd455e2eef50ab896bbeaf494da6b222f7c198fca0ba1f2e523c449fcad5515d5ee98b63919d9600d6c6465e0b30084a4
6
+ metadata.gz: 152c64c9c6e200677efda852adf0db068c1f39031d9975da0d339710ed6d94d78e434960d95a9417df70c859103c8036f9c35f90c3f07973c04ef958c814a8dc
7
+ data.tar.gz: b9823df969b1432395c29f88ebeb88cc20cea8af6dee1f9364c60574565204c68e63e4fedf0d1a3409f74ab2688aaa9426ab8a2581cdd2ef8962ce0a10a37d45
data/.reek.yml CHANGED
@@ -58,19 +58,26 @@ detectors:
58
58
  - Array
59
59
  NilCheck:
60
60
  enabled: false
61
+ DataClump:
62
+ enabled: true
63
+ exclude:
64
+ - SidekiqUniqueJobs::Util
61
65
  FeatureEnvy:
62
66
  exclude:
63
- - SidekiqUniqueJobs::OnConflict::Reject#push_to_deadset
67
+ - SidekiqUniqueJobs::Digests#batch_delete
68
+ - SidekiqUniqueJobs::Digests#page
64
69
  - SidekiqUniqueJobs::Logging#debug_item
70
+ - SidekiqUniqueJobs::OnConflict::Reject#push_to_deadset
65
71
  - SidekiqUniqueJobs::Util#batch_delete
66
- - SidekiqUniqueJobs::Digests#batch_delete
72
+ - SidekiqUniqueJobs::Web::Helpers#cparams
67
73
  NestedIterators:
68
74
  exclude:
75
+ - SidekiqUniqueJobs::Digests#batch_delete
69
76
  - SidekiqUniqueJobs::Locksmith#create_lock
70
77
  - SidekiqUniqueJobs::Middleware#configure_client_middleware
71
78
  - SidekiqUniqueJobs::Middleware#configure_server_middleware
72
79
  - SidekiqUniqueJobs::Util#batch_delete
73
- - SidekiqUniqueJobs::Digests#batch_delete
80
+ - SidekiqUniqueJobs::Util#keys_with_ttl
74
81
  TooManyInstanceVariables:
75
82
  exclude:
76
83
  - SidekiqUniqueJobs::Locksmith
@@ -1,3 +1,12 @@
1
+ ## v6.0.2
2
+
3
+ - Fixes sidekiq web pagination of unique digests
4
+ - Fixes lock_expiration usage (Lua doesn't support expire after persisting a key)
5
+
6
+ ## v6.0.1
7
+
8
+ - Remove unused method that causes conflict with sidekiq/web
9
+
1
10
  ## v6.0.0
2
11
 
3
12
  - Complete rewrite of the locking mechanism
data/README.md CHANGED
@@ -379,7 +379,7 @@ end
379
379
 
380
380
  ## Debugging
381
381
 
382
- There are two ways to display and remove keys regarding uniqueness. The console way and the command line way.
382
+ There are several ways of removing keys that are stuck. The prefered way is by using the unique extension to `Sidekiq::Web`. The old console and command line versions still work but might be deprecated in the future. It is better to search for the digest itself and delete the keys matching that digest.
383
383
 
384
384
  ### Sidekiq Web
385
385
 
@@ -23,6 +23,7 @@ module SidekiqUniqueJobs
23
23
  # @return [String] the sidekiq job id
24
24
  def lock
25
25
  @attempt = 0
26
+ return item[JID_KEY] if locked?
26
27
 
27
28
  if (token = locksmith.lock(item[LOCK_TIMEOUT_KEY]))
28
29
  token
@@ -106,7 +106,7 @@ module SidekiqUniqueJobs
106
106
  end
107
107
 
108
108
  # Signal that the token should be released
109
- # @param [String] token the unique token to check for a lockk.
109
+ # @param [String] token the unique token to check for a lock.
110
110
  # nil will default to the jid provided in the initializer.
111
111
  # @return [Integer] the number of available lock resources
112
112
  def signal(token = nil)
@@ -14,6 +14,7 @@ module SidekiqUniqueJobs
14
14
  log: OnConflict::Log,
15
15
  raise: OnConflict::Raise,
16
16
  reject: OnConflict::Reject,
17
+ replace: OnConflict::Replace,
17
18
  reschedule: OnConflict::Reschedule,
18
19
  }.freeze
19
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SidekiqUniqueJobs
4
4
  module OnConflict
5
- # Strategy to raise an error on conflict
5
+ # Strategy to replace the job on conflict
6
6
  #
7
7
  # @author Mikael Henriksson <mikael@zoolutions.se>
8
8
  class Replace < OnConflict::Strategy
@@ -23,6 +23,20 @@ module SidekiqUniqueJobs
23
23
  redis { |conn| conn.scan_each(match: prefix(pattern), count: count).to_a }
24
24
  end
25
25
 
26
+ # Find unique keys with ttl
27
+ # @param [String] pattern a pattern to scan for in redis
28
+ # @param [Integer] count the maximum number of keys to delete
29
+ # @return [Hash<String, Integer>] a hash with active unique keys and corresponding ttl
30
+ def keys_with_ttl(pattern = SCAN_PATTERN, count = DEFAULT_COUNT)
31
+ hash = {}
32
+ redis do |conn|
33
+ conn.scan_each(match: prefix(pattern), count: count).each do |key|
34
+ hash[key] = conn.ttl(key)
35
+ end
36
+ end
37
+ hash
38
+ end
39
+
26
40
  # Deletes unique keys from redis
27
41
  #
28
42
  # @param [String] pattern a pattern to scan for in redis
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqUniqueJobs
4
- VERSION = '6.0.2'
4
+ VERSION = '6.0.3'
5
5
  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: 6.0.2
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby