sidekiq-unique-jobs 7.1.7 → 7.1.12

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: caf49af950fdcdac84c9c4d4567cfb8697aa93c21640b7e32368e42e20808708
4
- data.tar.gz: aec81add0a9d86582d03c104600e0aee90429cd437928761f91d7350a415dc6b
3
+ metadata.gz: 636522bb794fcb282d02d8f0978f25764dea0c0eb07a80886d88be4212094529
4
+ data.tar.gz: 875231fe2ef546537ab6d152366c2555d664ca79951a4a1af563a78b7cd6efe8
5
5
  SHA512:
6
- metadata.gz: 6f1a2c59d5facc875f25f1436fb04ef2ef36023212476b2ce036694094df8c00e11cdf16f936c67ba649ef2705e6d915bce6f93ac13c3ae50c4bdbba3f83f9f7
7
- data.tar.gz: 0110e9e2ea06c40c39f083315254510de87d3c411d494047f0af9bc97586403edf88cf09d553a98046d750546dd283acc247a3627ecf623a67516004d6493eea
6
+ metadata.gz: db7884313d19f561be0ee68327f1068647123919450d72eee8ddba504d8105d16fa72b4930f990cc5904cea742b4307731ebdec6baeb00dc15e4271c9d8ab7d4
7
+ data.tar.gz: 923268a0919c0787ee835399c1a1b01e5a98b0c103cf59faf9361bc218fa7f19a5a2f13ed84b751588f25a7ea682bae67c36c0f0e8e5a7a90b3598b4bcac82dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,67 @@
1
1
  # Changelog
2
2
 
3
+ ## [v7.1.11](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.11) (2021-11-30)
4
+
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.10...v7.1.11)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix ruby reaper edge case [\#661](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/661) ([mhenrixon](https://github.com/mhenrixon))
10
+
11
+ **Closed issues:**
12
+
13
+ - Question: Wait instead of cancelling if it is executing? [\#655](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/655)
14
+ - Expired Locks remain in zset of digests \[using "until\_expired" lock\] [\#653](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/653)
15
+ - \[Q&A\] Performance & Dead Locks [\#652](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/652)
16
+ - Sidekiq 6.3.0 includes Job module that clashes with sidekiq\_unique\_ext.rb class Job [\#651](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/651)
17
+
18
+ ## [v7.1.10](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.10) (2021-10-18)
19
+
20
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.8...v7.1.10)
21
+
22
+ **Fixed bugs:**
23
+
24
+ - "IndexError: string not matched" when job is replaced on client [\#635](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/635)
25
+
26
+ **Merged pull requests:**
27
+
28
+ - Update URL for Sidekiq's Enterprise unique jobs [\#648](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/648) ([jsantos](https://github.com/jsantos))
29
+
30
+ ## [v7.1.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.8) (2021-10-08)
31
+
32
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.13...v7.1.8)
33
+
34
+ **Fixed bugs:**
35
+
36
+ - undefined method `delete' for class `Sidekiq::Job' [\#634](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/634)
37
+ - INFO keys not persisted when job is enqueued [\#602](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/602)
38
+ - lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
39
+ - Prevent too eager cleanup of lock info [\#645](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/645) ([mhenrixon](https://github.com/mhenrixon))
40
+
41
+ **Closed issues:**
42
+
43
+ - Compatibility with unreleased Sidekiq 6.3.0 [\#636](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/636)
44
+
45
+ **Merged pull requests:**
46
+
47
+ - Update docs [\#644](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/644) ([andypple](https://github.com/andypple))
48
+
49
+ ## [v7.0.13](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.13) (2021-09-27)
50
+
51
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.7...v7.0.13)
52
+
53
+ ## [v7.1.7](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.7) (2021-09-27)
54
+
55
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.6...v7.1.7)
56
+
57
+ **Implemented enhancements:**
58
+
59
+ - Styles [\#642](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/642) ([mhenrixon](https://github.com/mhenrixon))
60
+
61
+ **Fixed bugs:**
62
+
63
+ - OnConflict::Replace: yield when lock was achieved [\#640](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/640) ([mhenrixon](https://github.com/mhenrixon))
64
+
3
65
  ## [v7.1.6](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.1.6) (2021-09-21)
4
66
 
5
67
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.1.5...v7.1.6)
@@ -125,7 +187,6 @@
125
187
 
126
188
  **Fixed bugs:**
127
189
 
128
- - lock\_info set to true but no lock info showing up in web ui [\#589](https://github.com/mhenrixon/sidekiq-unique-jobs/issues/589)
129
190
  - Fix recording lock\_info [\#599](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/599) ([mhenrixon](https://github.com/mhenrixon))
130
191
 
131
192
  ## [v7.0.8](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.8) (2021-04-14)
data/README.md CHANGED
@@ -1043,7 +1043,7 @@ There is a [![Join the chat at https://gitter.im/mhenrixon/sidekiq-unique-jobs](
1043
1043
 
1044
1044
  You can find a list of contributors over on [Contributors][]
1045
1045
 
1046
- [Enterprise unique jobs]: https://www.dailydrip.com/topics/sidekiq/drips/sidekiq-enterprise-unique-jobs
1046
+ [Enterprise unique jobs]: https://github.com/mperham/sidekiq/wiki/Ent-Unique-Jobs
1047
1047
  [Contributors]: https://github.com/mhenrixon/sidekiq-unique-jobs/graphs/contributors
1048
1048
  [v4.0.18]: https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v4.0.18
1049
1049
  [v5.0.10]: https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v5.0.10.
@@ -31,7 +31,8 @@ module SidekiqUniqueJobs
31
31
  #
32
32
  # @param [String] pattern a key pattern to match with
33
33
  # @param [Integer] count the maximum number
34
- # @return [Array<String>] with unique digests
34
+ # @return [Hash<String,Float>] Hash mapping of digest matching the given pattern and score
35
+
35
36
  def delete_by_pattern(pattern, count: DEFAULT_COUNT)
36
37
  result, elapsed = timed do
37
38
  digests = entries(pattern: pattern, count: count).keys
@@ -80,11 +81,7 @@ module SidekiqUniqueJobs
80
81
  options[:match] = pattern
81
82
  options[:count] = count
82
83
 
83
- result = redis { |conn| conn.zscan_each(key, **options).to_a }
84
-
85
- result.each_with_object({}) do |entry, hash|
86
- hash[entry[0]] = entry[1]
87
- end
84
+ redis { |conn| conn.zscan_each(key, **options).to_a }.to_h
88
85
  end
89
86
 
90
87
  #
@@ -76,6 +76,9 @@ if pttl and pttl > 0 then
76
76
 
77
77
  log_debug("PEXPIRE", locked, pttl)
78
78
  redis.call("PEXPIRE", locked, pttl)
79
+
80
+ log_debug("PEXPIRE", info, pttl)
81
+ redis.call("PEXPIRE", info, pttl)
79
82
  end
80
83
 
81
84
  log_debug("PEXPIRE", queued, 1000)
@@ -84,9 +87,6 @@ redis.call("PEXPIRE", queued, 1000)
84
87
  log_debug("PEXPIRE", primed, 1000)
85
88
  redis.call("PEXPIRE", primed, 1000)
86
89
 
87
- log_debug("PEXPIRE", info, 1000)
88
- redis.call("PEXPIRE", info, 1000)
89
-
90
90
  log("Locked")
91
91
  log_debug("END lock digest:", digest, "job_id:", job_id)
92
92
  return job_id
@@ -65,11 +65,6 @@ redis.call("LREM", queued, -1, job_id)
65
65
  log_debug("LREM", primed, -1, job_id)
66
66
  redis.call("LREM", primed, -1, job_id)
67
67
 
68
- if limit and limit <= 1 and locked_count and locked_count <= 1 then
69
- log_debug("ZREM", digests, digest)
70
- redis.call("ZREM", digests, digest)
71
- end
72
-
73
68
  local redis_version = toversion(redisversion)
74
69
  local del_cmd = "DEL"
75
70
 
@@ -83,6 +78,18 @@ if lock_type ~= "until_expired" then
83
78
  redis.call("HDEL", locked, job_id)
84
79
  end
85
80
 
81
+ local locked_count = redis.call("HLEN", locked)
82
+
83
+ if locked_count and locked_count < 1 then
84
+ log_debug(del_cmd, locked)
85
+ redis.call(del_cmd, locked)
86
+ end
87
+
88
+ if limit and limit <= 1 and locked_count and locked_count <= 1 then
89
+ log_debug("ZREM", digests, digest)
90
+ redis.call("ZREM", digests, digest)
91
+ end
92
+
86
93
  log_debug("LPUSH", queued, "1")
87
94
  redis.call("LPUSH", queued, "1")
88
95
 
@@ -9,6 +9,7 @@ module SidekiqUniqueJobs
9
9
  #
10
10
  # @author Mikael Henriksson <mikael@mhenrixon.com>
11
11
  #
12
+ # rubocop:disable Metrics/ClassLength
12
13
  class RubyReaper < Reaper
13
14
  #
14
15
  # @return [String] the suffix for :RUN locks
@@ -54,13 +55,27 @@ module SidekiqUniqueJobs
54
55
  #
55
56
  # @return [Array<String>] an array of orphaned digests
56
57
  #
57
- def orphans
58
- conn.zrevrange(digests.key, 0, -1).each_with_object([]) do |digest, memo|
59
- next if belongs_to_job?(digest)
58
+ def orphans # rubocop:disable Metrics/MethodLength
59
+ page = 0
60
+ per = reaper_count * 2
61
+ orphans = []
62
+ results = conn.zrange(digests.key, page * per, (page + 1) * per)
60
63
 
61
- memo << digest
62
- break if memo.size >= reaper_count
64
+ while results.size.positive?
65
+ results.each do |digest|
66
+ next if belongs_to_job?(digest)
67
+
68
+ orphans << digest
69
+ break if orphans.size >= reaper_count
70
+ end
71
+
72
+ break if orphans.size >= reaper_count
73
+
74
+ page += 1
75
+ results = conn.zrange(digests.key, page * per, (page + 1) * per)
63
76
  end
77
+
78
+ orphans
64
79
  end
65
80
 
66
81
  #
@@ -211,5 +226,6 @@ module SidekiqUniqueJobs
211
226
  conn.zscan_each(key, match: "*#{digest}*", count: 1).to_a.any?
212
227
  end
213
228
  end
229
+ # rubocop:enable Metrics/ClassLength
214
230
  end
215
231
  end
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.1.7"
6
+ VERSION = "7.1.12"
7
7
  end
@@ -16,7 +16,7 @@ COMMIT_CHANGELOG_CMD = "git commit -a -m 'Update changelog'"
16
16
 
17
17
  desc "Generate a Changelog"
18
18
  task :changelog do
19
- sh("git checkout master")
19
+ sh("git checkout main")
20
20
  sh(*CHANGELOG_CMD.push(ENV["CHANGELOG_GITHUB_TOKEN"]))
21
21
  sh(ADD_CHANGELOG_CMD)
22
22
  sh(COMMIT_CHANGELOG_CMD)
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.1.7
4
+ version: 7.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-27 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brpoplpush-redis_script
@@ -215,15 +215,11 @@ homepage: https://mhenrixon.github.io/sidekiq-unique-jobs
215
215
  licenses:
216
216
  - MIT
217
217
  metadata:
218
- homepage_uri: https://mhenrixon.github.io/sidekiq-unique-jobs
219
- bug_tracker_uri: https://github.com/mhenrixon/sidekiq-unique-jobs/issues
220
- documentation_uri: https://mhenrixon.github.io/sidekiq-unique-jobs
221
- source_code_uri: https://github.com/mhenrixon/sidekiq-unique-jobs
222
- changelog_uri: https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/CHANGELOG.md
218
+ rubygems_mfa_required: 'true'
223
219
  post_install_message: |
224
220
  IMPORTANT!
225
221
 
226
- Automatic configuration of the sidekiq middelware is no longer done.
222
+ Automatic configuration of the sidekiq middleware is no longer done.
227
223
  Please see: https://github.com/mhenrixon/sidekiq-unique-jobs/blob/master/README.md#add-the-middleware
228
224
 
229
225
  This version deprecated the following sidekiq_options
@@ -261,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
257
  - !ruby/object:Gem::Version
262
258
  version: '0'
263
259
  requirements: []
264
- rubygems_version: 3.2.28
260
+ rubygems_version: 3.2.32
265
261
  signing_key:
266
262
  specification_version: 4
267
263
  summary: Sidekiq middleware that prevents duplicates jobs