sidekiq-scheduler 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq-scheduler/schedule.rb +2 -4
- data/lib/sidekiq-scheduler/version.rb +1 -1
- data/lib/sidekiq-scheduler/web.rb +2 -0
- data/lib/sidekiq/scheduler.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f9d5095b0da933e653ac5a47bc0a0a0057ad48b
|
4
|
+
data.tar.gz: 9daee302488e577371f041188e7d0f84d9833913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d356b101fd6427b204c46317604e2791135810173480b8ddfe4edb6c991008c9369b260dc576a7500ef33b8475ddbde41dab8d0bf281ccece6925e7aa75259a6
|
7
|
+
data.tar.gz: c6023a20103f5fdf9744e82435b2a68a6c2ec0407225602623886ede7297883a73e0523a4f664de5125ddc32318384122e2cf568eab5c5f7f46d0f6073cfb20d
|
@@ -53,8 +53,6 @@ module SidekiqScheduler
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def schedule
|
56
|
-
reload_schedule! unless @schedule
|
57
|
-
|
58
56
|
@schedule
|
59
57
|
end
|
60
58
|
|
@@ -106,7 +104,7 @@ module SidekiqScheduler
|
|
106
104
|
existing_config = get_schedule(name)
|
107
105
|
unless existing_config && existing_config == config
|
108
106
|
Sidekiq.redis { |r| r.hset(:schedules, name, JSON.generate(config)) }
|
109
|
-
Sidekiq.redis { |r| r.
|
107
|
+
Sidekiq.redis { |r| r.zadd(:schedules_changed, Time.now.to_f, name) }
|
110
108
|
end
|
111
109
|
config
|
112
110
|
end
|
@@ -114,7 +112,7 @@ module SidekiqScheduler
|
|
114
112
|
# remove a given schedule by name
|
115
113
|
def remove_schedule(name)
|
116
114
|
Sidekiq.redis { |r| r.hdel(:schedules, name) }
|
117
|
-
Sidekiq.redis { |r| r.
|
115
|
+
Sidekiq.redis { |r| r.zadd(:schedules_changed, Time.now.to_f, name) }
|
118
116
|
end
|
119
117
|
|
120
118
|
private
|
data/lib/sidekiq/scheduler.rb
CHANGED
@@ -54,6 +54,7 @@ module Sidekiq
|
|
54
54
|
# Load schedule from redis for the first time if dynamic
|
55
55
|
if dynamic
|
56
56
|
Sidekiq.reload_schedule!
|
57
|
+
@current_changed_score = Time.now.to_f
|
57
58
|
rufus_scheduler.every('5s') do
|
58
59
|
update_schedule
|
59
60
|
end
|
@@ -73,7 +74,7 @@ module Sidekiq
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
Sidekiq.redis { |r| r.del(:schedules_changed) }
|
77
|
+
Sidekiq.redis { |r| r.del(:schedules_changed) unless r.type(:schedules_changed) == 'zset' }
|
77
78
|
|
78
79
|
logger.info 'Schedules Loaded'
|
79
80
|
else
|
@@ -207,10 +208,15 @@ module Sidekiq
|
|
207
208
|
end
|
208
209
|
|
209
210
|
def update_schedule
|
210
|
-
|
211
|
+
last_changed_score, @current_changed_score = @current_changed_score, Time.now.to_f
|
212
|
+
schedule_changes = Sidekiq.redis do |r|
|
213
|
+
r.zrangebyscore :schedules_changed, last_changed_score, "(#{@current_changed_score}"
|
214
|
+
end
|
215
|
+
|
216
|
+
if schedule_changes.size > 0
|
211
217
|
logger.info 'Updating schedule'
|
212
218
|
Sidekiq.reload_schedule!
|
213
|
-
|
219
|
+
schedule_changes.each do |schedule_name|
|
214
220
|
if Sidekiq.schedule.keys.include?(schedule_name)
|
215
221
|
unschedule_job(schedule_name)
|
216
222
|
load_schedule_job(schedule_name, Sidekiq.schedule[schedule_name])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morton Jonuschat
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-06-
|
12
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|