sidekiq-unique-jobs 7.0.0.beta18 → 7.0.0.beta19
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/sidekiq_unique_jobs/orphans/manager.rb +25 -2
- data/lib/sidekiq_unique_jobs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0533eff22c876bdbba1624e7bd997a0bfaa1254fe372bfc24fc67c95d2001eaf
|
4
|
+
data.tar.gz: 8bf21d326a04268bab7b4981af462649724a9e1ea5d312cdc5fe1e58b23f40d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645799c00a61c3665c63eaf77203c20db9220188aa757a19799a1f1863a8949fc2e8a71e023d8f3b39f3583534d74903dc39a7c6926c0c7ec37fa16ee61d9801
|
7
|
+
data.tar.gz: 5da81c81bd550d9181190d583aa742d4ee65cc2a7a470ce5f7d3e595b74244ac9af39757900f9a7d7ecee0792f27022679080cde87b5c202c50b495b011e3727
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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,
|
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
|