sidekiq-scheduler 2.0.19 → 2.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/sidekiq-scheduler.rb +4 -1
- data/lib/sidekiq-scheduler/job_presenter.rb +3 -1
- data/lib/sidekiq-scheduler/manager.rb +1 -1
- data/lib/sidekiq-scheduler/schedule.rb +4 -5
- data/lib/sidekiq-scheduler/version.rb +1 -1
- 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: b0729c34d520add53c677fd20e22ee3a29ee1e29
|
4
|
+
data.tar.gz: b437226e4b3c9214cca3e595c4e891e45de5672c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 389f35144c0135f392266d6fd68fc8144fe06599475cd956ad1c70e4fa3c29eb0fa8c7f0609373e55ba6e610f6f616366d15164e171785e92b2ea0dd25b52cff
|
7
|
+
data.tar.gz: 021b55299dff4d7b00a6a3cf1a34acf52d44ceaa92d79ad3ccf3321b11534c2acfcf646887a08caeda317029bb03fcbe47430a178504aaaa048ded7830483caf
|
data/README.md
CHANGED
@@ -145,6 +145,16 @@ seconds past the minute).
|
|
145
145
|
A big shout out to [rufus-scheduler](http://github.com/jmettraux/rufus-scheduler)
|
146
146
|
for handling the heavy lifting of the actual scheduling engine.
|
147
147
|
|
148
|
+
NOTE: As schedules are persisted in Redis, an empty schedule will purge any schedule previously stored.
|
149
|
+
sidekiq-scheduler instances running with `dynamic` flag set to `true` and empty schedule configuration will not push any job.
|
150
|
+
Before version 2.0.8, instances matching those conditions read the previously stored schedule and push the jobs to sidekiq as usual.
|
151
|
+
|
152
|
+
With version >= `2.0.8` the purge of Redis schedules config can be prevented by setting
|
153
|
+
`enabled` flag to `false`:
|
154
|
+
|
155
|
+
```yaml
|
156
|
+
:enabled: false
|
157
|
+
```
|
148
158
|
### Enabling/Disabling jobs
|
149
159
|
|
150
160
|
By default all the jobs are enabled. There is an option at job's configuration to change
|
data/lib/sidekiq-scheduler.rb
CHANGED
@@ -18,10 +18,13 @@ Sidekiq.configure_server do |config|
|
|
18
18
|
listened_queues_only = Sidekiq::Scheduler.listened_queues_only
|
19
19
|
listened_queues_only = listened_queues_only.nil? ? scheduler[:listened_queues_only] : listened_queues_only
|
20
20
|
|
21
|
+
schedule = Sidekiq.schedule
|
22
|
+
schedule ||= config.options[:schedule] || {}
|
23
|
+
|
21
24
|
scheduler_options = {
|
22
25
|
dynamic: dynamic,
|
23
26
|
enabled: enabled,
|
24
|
-
schedule:
|
27
|
+
schedule: schedule,
|
25
28
|
listened_queues_only: listened_queues_only
|
26
29
|
}
|
27
30
|
|
@@ -54,7 +54,9 @@ module SidekiqScheduler
|
|
54
54
|
# @param schedule_hash [Hash] with the redis schedule
|
55
55
|
# @return [Array<JobPresenter>] an array with the instances of presenters
|
56
56
|
def self.build_collection(schedule_hash)
|
57
|
-
|
57
|
+
schedule_hash ||= {}
|
58
|
+
|
59
|
+
schedule_hash.map do |name, job_spec|
|
58
60
|
new(name, job_spec)
|
59
61
|
end
|
60
62
|
end
|
@@ -18,7 +18,7 @@ module SidekiqScheduler
|
|
18
18
|
Sidekiq::Scheduler.enabled = options[:enabled]
|
19
19
|
Sidekiq::Scheduler.dynamic = options[:dynamic]
|
20
20
|
Sidekiq::Scheduler.listened_queues_only = options[:listened_queues_only]
|
21
|
-
Sidekiq.schedule = options[:schedule]
|
21
|
+
Sidekiq.schedule = options[:schedule]
|
22
22
|
end
|
23
23
|
|
24
24
|
def stop
|
@@ -38,7 +38,7 @@ module SidekiqScheduler
|
|
38
38
|
# param, otherwise params is passed in as the only parameter to perform.
|
39
39
|
def schedule=(schedule_hash)
|
40
40
|
schedule_hash = prepare_schedule(schedule_hash)
|
41
|
-
to_remove =
|
41
|
+
to_remove = get_all_schedules.keys - schedule_hash.keys.map(&:to_s)
|
42
42
|
|
43
43
|
schedule_hash.each do |name, job_spec|
|
44
44
|
set_schedule(name, job_spec)
|
@@ -52,7 +52,7 @@ module SidekiqScheduler
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def schedule
|
55
|
-
@schedule
|
55
|
+
@schedule
|
56
56
|
end
|
57
57
|
|
58
58
|
# Reloads the schedule from Redis and return it.
|
@@ -77,10 +77,9 @@ module SidekiqScheduler
|
|
77
77
|
|
78
78
|
# gets the schedule as it exists in redis
|
79
79
|
def get_all_schedules
|
80
|
-
schedules =
|
81
|
-
if Sidekiq.redis { |r| r.exists(:schedules) }
|
82
|
-
schedules = {}
|
80
|
+
schedules = {}
|
83
81
|
|
82
|
+
if Sidekiq.redis { |r| r.exists(:schedules) }
|
84
83
|
Sidekiq.redis { |r| r.hgetall(:schedules) }.tap do |h|
|
85
84
|
h.each do |name, config|
|
86
85
|
schedules[name] = JSON(config)
|
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.0.
|
4
|
+
version: 2.0.20
|
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: 2016-10-
|
12
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|