sidekiq-unique-jobs 7.0.0.beta18 → 7.0.0.beta19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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: eb3027ef2ed3a7a9a35732783f58c8ea1b55052b6c10c6d8de9acb6e44df389a
4
- data.tar.gz: ad1baf2e0ad2aa7813109e6cd96aacab888d1bdefb58bcc5b5e5561bbb02404c
3
+ metadata.gz: 0533eff22c876bdbba1624e7bd997a0bfaa1254fe372bfc24fc67c95d2001eaf
4
+ data.tar.gz: 8bf21d326a04268bab7b4981af462649724a9e1ea5d312cdc5fe1e58b23f40d7
5
5
  SHA512:
6
- metadata.gz: 7c6f06b180fbedd9b17c46e0fac20c7d1729571f830e8c01ea3bc63418cec618d4cfe3c8baa52319923e041960d6504e91488d5f59b41f7b7fa5960635a6142d
7
- data.tar.gz: 68e8314bb873315007aa6abe1fb6f8cdf132b76720ef7623329ddb46244dd8f275902aeceac3cdbf19f82dd3cd5b9de8dc6f57856199cbd1748c1c54ca4977f2
6
+ metadata.gz: 645799c00a61c3665c63eaf77203c20db9220188aa757a19799a1f1863a8949fc2e8a71e023d8f3b39f3583534d74903dc39a7c6926c0c7ec37fa16ee61d9801
7
+ data.tar.gz: 5da81c81bd550d9181190d583aa742d4ee65cc2a7a470ce5f7d3e595b74244ac9af39757900f9a7d7ecee0792f27022679080cde87b5c202c50b495b011e3727
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v7.0.0.beta18](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta18) (2020-05-21)
4
+
5
+ [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta17...v7.0.0.beta18)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Stringify on\_conflict hash in Job prepare method [\#507](https://github.com/mhenrixon/sidekiq-unique-jobs/pull/507) ([jasonbekolay](https://github.com/jasonbekolay))
10
+
3
11
  ## [v7.0.0.beta17](https://github.com/mhenrixon/sidekiq-unique-jobs/tree/v7.0.0.beta17) (2020-05-20)
4
12
 
5
13
  [Full Changelog](https://github.com/mhenrixon/sidekiq-unique-jobs/compare/v7.0.0.beta16...v7.0.0.beta17)
@@ -10,6 +10,8 @@ module SidekiqUniqueJobs
10
10
  module Manager
11
11
  module_function
12
12
 
13
+ DRIFT_FACTOR = 0.02
14
+
13
15
  include SidekiqUniqueJobs::Connection
14
16
  include SidekiqUniqueJobs::Logging
15
17
 
@@ -56,6 +58,7 @@ module SidekiqUniqueJobs
56
58
  @task ||= Concurrent::TimerTask.new(timer_task_options) do
57
59
  with_logging_context do
58
60
  redis do |conn|
61
+ refresh_reaper_mutex
59
62
  Orphans::Reaper.call(conn)
60
63
  end
61
64
  end
@@ -117,7 +120,9 @@ module SidekiqUniqueJobs
117
120
  # @return [true, false]
118
121
  #
119
122
  def registered?
120
- redis { |conn| conn.get(UNIQUE_REAPER) }.to_i == 1
123
+ redis do |conn|
124
+ conn.get(UNIQUE_REAPER).to_i + drift_reaper_interval > current_timestamp
125
+ end
121
126
  end
122
127
 
123
128
  def disabled?
@@ -131,7 +136,17 @@ module SidekiqUniqueJobs
131
136
  # @return [void]
132
137
  #
133
138
  def register_reaper_process
134
- redis { |conn| conn.set(UNIQUE_REAPER, 1) }
139
+ redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, nx: true, ex: drift_reaper_interval) }
140
+ end
141
+
142
+ #
143
+ # Updates mutex key
144
+ #
145
+ #
146
+ # @return [void]
147
+ #
148
+ def refresh_reaper_mutex
149
+ redis { |conn| conn.set(UNIQUE_REAPER, current_timestamp, ex: drift_reaper_interval) }
135
150
  end
136
151
 
137
152
  #
@@ -143,6 +158,14 @@ module SidekiqUniqueJobs
143
158
  def unregister_reaper_process
144
159
  redis { |conn| conn.del(UNIQUE_REAPER) }
145
160
  end
161
+
162
+ def drift_reaper_interval
163
+ reaper_interval + (reaper_interval * DRIFT_FACTOR).to_i
164
+ end
165
+
166
+ def current_timestamp
167
+ Time.now.to_i
168
+ end
146
169
  end
147
170
  end
148
171
  end
@@ -3,5 +3,5 @@
3
3
  module SidekiqUniqueJobs
4
4
  #
5
5
  # @return [String] the current SidekiqUniqueJobs version
6
- VERSION = "7.0.0.beta18"
6
+ VERSION = "7.0.0.beta19"
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: 7.0.0.beta18
4
+ version: 7.0.0.beta19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson