sidekiq-unique-jobs 8.0.4 → 8.0.5

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: 35c1bacf5f3ad9218a2791aa90b38a9f76e98aa53891ebbfb764b948c00b21fe
4
- data.tar.gz: 750b7b72457f8f58c50f3419eba36954a8a518dc77473861f8d18e5fd8542975
3
+ metadata.gz: 1573748a7de5be552d85b9e74143425fd99b2e85e4e6be1ccdbbd8ba9ecc0f37
4
+ data.tar.gz: 520fe1d492c9e088df5b6dc138d8bc4024516486c216e8223fe0f55462cfe691
5
5
  SHA512:
6
- metadata.gz: ea41240b24e440d3042a59570665b54e8bc9ffe186e10cdf4259a7f196c86f689c149586db0a37d02f75308b91fc1aedb0641f10e4d8565a0d70c4684371ad19
7
- data.tar.gz: d12af8379f1262f92fefde8ca4fe4fbf80ff7ff2cbab477c12b3440e7d0513488adc2a6b7dbbd059ea033c7688b89734af52521b39086bacd01271de66ed449c
6
+ metadata.gz: 23542e9860f30b16f14c1907790e1bd491e98524dad73b726b88592b8e0cbcf06fa4b535837fc534e4ccf4a80d619840bdf7ec01c3104e3053f1ec5661ea92d5
7
+ data.tar.gz: d61c18630ab31064bac8ed9fad52fc84a08ad9bc384ac39d9ed8a44e6e4b741aafa0ebd2845a9f465da8e811e634dab0a8f92ee768c9bb19f9ba8cdb64b10190
data/CHANGELOG.md CHANGED
@@ -1,11 +1,41 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/HEAD)
3
+ ## [v8.0.4](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v8.0.4) (2023-11-11)
4
4
 
5
- [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.3...HEAD)
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.30...v8.0.4)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - fix: ignore reek for now [\#818](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/818) ([mhenrixon](https://github.com/mhenrixon))
10
+ - fix\(ci\): allow tests to run in docker [\#805](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/805) ([Earlopain](https://github.com/Earlopain))
11
+ - chore\(deps\): bump'n lint'n such [\#797](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/797) ([mhenrixon](https://github.com/mhenrixon))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Sidekiq 7: Unsupported command argument type: TrueClass [\#816](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/816)
16
+ - fix\(web\): don't show bogus lock digests [\#804](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/804) ([Earlopain](https://github.com/Earlopain))
17
+
18
+ **Closed issues:**
19
+
20
+ - register\_reaper\_process nx: true crash Sidekiq on startup [\#817](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/817)
21
+ - Should client middleware also be added to the Sidekiq server config? [\#803](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/803)
22
+ - 8.0.1 Time on locks & changelog UI is incorrect/wrong [\#761](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/761)
23
+ - Job executed twice when reaper runs [\#738](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/738)
24
+
25
+ **Merged pull requests:**
26
+
27
+ - fix: Sidekiq 7.2 throws TypeError: Unsupported command argument type: TrueClass when using byscore: true [\#815](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/815) ([Amnesthesia](https://github.com/Amnesthesia))
28
+ - Add sidekiq\_option for on-conflict-reschedule perform\_in time [\#813](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/813) ([mgmarlow](https://github.com/mgmarlow))
29
+ - Handle strategy fallbacks properly [\#809](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/809) ([matejrisek](https://github.com/matejrisek))
30
+ - Fix CI status badge [\#802](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/802) ([tagliala](https://github.com/tagliala))
31
+
32
+ ## [v7.1.30](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.30) (2023-07-17)
33
+
34
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v8.0.3...v7.1.30)
6
35
 
7
36
  **Closed issues:**
8
37
 
38
+ - Release new gem version with "fix replace deprecated rpoplpush w/lmove" [\#795](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/795)
9
39
  - Redis has deprecated the `rpoplpush`command [\#793](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/793)
10
40
  - Deprecation Warning: Use of rpoplpush command in Redis [\#792](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/792)
11
41
  - Logging::Middleware.context can include empty string as key when lock is not set in job hash [\#785](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/785)
@@ -7,6 +7,16 @@ module SidekiqUniqueJobs
7
7
  # @author Mikael Henriksson <mikael@mhenrixon.com>
8
8
  #
9
9
  class Digests < Redis::SortedSet
10
+ #
11
+ # @return [Integer] the number of matches to return by default
12
+ DEFAULT_COUNT = 1_000
13
+ #
14
+ # @return [String] the default pattern to use for matching
15
+ SCAN_PATTERN = "*"
16
+ #
17
+ # @return [Array(String, String, String, String)] The empty runtime or queuetime keys.
18
+ EMPTY_KEYS_SEGMENT = ["", "", "", ""].freeze
19
+
10
20
  def initialize(digests_key = DIGESTS)
11
21
  super(digests_key)
12
22
  end
@@ -41,19 +51,14 @@ module SidekiqUniqueJobs
41
51
  # Also deletes the :AVAILABLE, :EXPIRED etc keys
42
52
  #
43
53
  # @param [String] digest a unique digest to delete
44
- def delete_by_digest(digest) # rubocop:disable Metrics/MethodLength
54
+ # @param queuetime [Boolean] Whether to delete queue locks.
55
+ # @param runtime [Boolean] Whether to delete run locks.
56
+ def delete_by_digest(digest, queuetime: true, runtime: true)
45
57
  result, elapsed = timed do
46
- call_script(:delete_by_digest, [
47
- digest,
48
- "#{digest}:QUEUED",
49
- "#{digest}:PRIMED",
50
- "#{digest}:LOCKED",
51
- "#{digest}:RUN",
52
- "#{digest}:RUN:QUEUED",
53
- "#{digest}:RUN:PRIMED",
54
- "#{digest}:RUN:LOCKED",
55
- key,
56
- ])
58
+ call_script(
59
+ :delete_by_digest,
60
+ queuetime_keys(queuetime ? digest : nil) + runtime_keys(runtime ? digest : nil) + [key],
61
+ )
57
62
  end
58
63
 
59
64
  log_info("#{__method__}(#{digest}) completed in #{elapsed}ms")
@@ -97,5 +102,33 @@ module SidekiqUniqueJobs
97
102
  ]
98
103
  end
99
104
  end
105
+
106
+ private
107
+
108
+ # @param digest [String, nil] The digest to form runtime keys from.
109
+ # @return [Array(String, String, String, String)] The list of runtime keys or empty strings if +digest+ was +nil+.
110
+ def runtime_keys(digest)
111
+ return EMPTY_KEYS_SEGMENT unless digest
112
+
113
+ [
114
+ "#{digest}:RUN",
115
+ "#{digest}:RUN:QUEUED",
116
+ "#{digest}:RUN:PRIMED",
117
+ "#{digest}:RUN:LOCKED",
118
+ ]
119
+ end
120
+
121
+ # @param digest [String, nil] The digest to form queuetime keys from.
122
+ # @return [Array(String, String, String, String)] The list of queuetime keys or empty strings if +digest+ was +nil+.
123
+ def queuetime_keys(digest)
124
+ return EMPTY_KEYS_SEGMENT unless digest
125
+
126
+ [
127
+ digest,
128
+ "#{digest}:QUEUED",
129
+ "#{digest}:PRIMED",
130
+ "#{digest}:LOCKED",
131
+ ]
132
+ end
100
133
  end
101
134
  end
@@ -42,6 +42,7 @@ module SidekiqUniqueJobs
42
42
  with_logging_context do
43
43
  executed = locksmith.execute do
44
44
  yield
45
+ item[JID]
45
46
  ensure
46
47
  unlock_and_callback
47
48
  end
@@ -65,7 +65,7 @@ module SidekiqUniqueJobs
65
65
  # @return [Integer] the number of keys deleted
66
66
  #
67
67
  def delete_lock
68
- digests.delete_by_digest(lock_digest)
68
+ digests.delete_by_digest(lock_digest, runtime: false)
69
69
  end
70
70
 
71
71
  #
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "8.0.4"
6
+ VERSION = "8.0.5"
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: 8.0.4
4
+ version: 8.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson