brianjlandau-resque-scheduler 1.10.4 → 1.10.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/brianjlandau-resque-scheduler.gemspec +1 -1
- data/lib/resque_scheduler.rb +1 -1
- data/lib/resque_scheduler/server.rb +1 -1
- data/lib/resque_scheduler/version.rb +1 -1
- data/test/scheduler_test.rb +10 -10
- metadata +3 -3
data/README.markdown
CHANGED
@@ -140,7 +140,7 @@ environment variable, the job won't be loaded.
|
|
140
140
|
|
141
141
|
### Dynamic Schedules
|
142
142
|
|
143
|
-
If needed you can also have schedules that are dynamically defined and updated inside of your application. This can be completed by loading the schedule initially wherever you configure Resque and setting `Resque::Scheduler.dynamic` to `true`. Then subsequently updating the "`
|
143
|
+
If needed you can also have schedules that are dynamically defined and updated inside of your application. This can be completed by loading the schedule initially wherever you configure Resque and setting `Resque::Scheduler.dynamic` to `true`. Then subsequently updating the "`schedules`" key in redis, namespaced to the Resque namespace. The "`schedules`" key is expected to be a redis hash data type, where the key is the name of the schedule and the value is a JSON encoded hash of the schedule configuration.
|
144
144
|
|
145
145
|
When the scheduler loops it will look for differences between the existing schedule and the current schedule in redis. If there are differences it will make the necessary changes to the running schedule.
|
146
146
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{brianjlandau-resque-scheduler}
|
8
|
-
s.version = "1.10.
|
8
|
+
s.version = "1.10.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben VandenBos", "Brian Landau"]
|
data/lib/resque_scheduler.rb
CHANGED
@@ -19,7 +19,7 @@ module ResqueScheduler
|
|
19
19
|
end
|
20
20
|
|
21
21
|
get "/schedule" do
|
22
|
-
Resque.reload_schedule! if Resque.
|
22
|
+
Resque.reload_schedule! if Resque::Scheduler.dynamic
|
23
23
|
# Is there a better way to specify alternate template locations with sinatra?
|
24
24
|
erb File.read(File.join(File.dirname(__FILE__), 'server/views/scheduler.erb'))
|
25
25
|
end
|
data/test/scheduler_test.rb
CHANGED
@@ -7,7 +7,7 @@ class Resque::SchedulerTest < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def setup
|
10
|
-
Resque.redis.del(:
|
10
|
+
Resque.redis.del(:schedules)
|
11
11
|
Resque::Scheduler.mute = true
|
12
12
|
Resque::Scheduler.clear_schedule!
|
13
13
|
Resque::Scheduler.send(:class_variable_set, :@@scheduled_jobs, {})
|
@@ -78,7 +78,7 @@ class Resque::SchedulerTest < Test::Unit::TestCase
|
|
78
78
|
|
79
79
|
def test_can_reload_schedule
|
80
80
|
Resque.schedule = {"some_ivar_job" => {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp"}}
|
81
|
-
Resque.redis.hset(:
|
81
|
+
Resque.redis.hset(:schedules, "some_ivar_job", Resque.encode(
|
82
82
|
{'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp"}
|
83
83
|
))
|
84
84
|
|
@@ -87,8 +87,8 @@ class Resque::SchedulerTest < Test::Unit::TestCase
|
|
87
87
|
assert_equal(1, Resque::Scheduler.rufus_scheduler.all_jobs.size)
|
88
88
|
assert Resque::Scheduler.scheduled_jobs.include?("some_ivar_job")
|
89
89
|
|
90
|
-
Resque.redis.del(:
|
91
|
-
Resque.redis.hset(:
|
90
|
+
Resque.redis.del(:schedules)
|
91
|
+
Resque.redis.hset(:schedules, "some_ivar_job2", Resque.encode(
|
92
92
|
{'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
|
93
93
|
))
|
94
94
|
|
@@ -133,13 +133,13 @@ class Resque::SchedulerTest < Test::Unit::TestCase
|
|
133
133
|
|
134
134
|
Resque::Scheduler.load_schedule!
|
135
135
|
|
136
|
-
Resque.redis.hset(:
|
136
|
+
Resque.redis.hset(:schedules, "some_ivar_job", Resque.encode(
|
137
137
|
{'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
|
138
138
|
))
|
139
|
-
Resque.redis.hset(:
|
139
|
+
Resque.redis.hset(:schedules, "new_ivar_job", Resque.encode(
|
140
140
|
{'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp/3"}
|
141
141
|
))
|
142
|
-
Resque.redis.hset(:
|
142
|
+
Resque.redis.hset(:schedules, "stay_put_job", Resque.encode(
|
143
143
|
{'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp"}
|
144
144
|
))
|
145
145
|
|
@@ -167,13 +167,13 @@ class Resque::SchedulerTest < Test::Unit::TestCase
|
|
167
167
|
Resque::Scheduler.rufus_scheduler.expects(:unschedule).with(Resque::Scheduler.scheduled_jobs["some_ivar_job"].job_id)
|
168
168
|
Resque::Scheduler.rufus_scheduler.expects(:unschedule).with(Resque::Scheduler.scheduled_jobs["another_ivar_job"].job_id)
|
169
169
|
|
170
|
-
Resque.redis.hset(:
|
170
|
+
Resque.redis.hset(:schedules, "some_ivar_job", Resque.encode(
|
171
171
|
{'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
|
172
172
|
))
|
173
|
-
Resque.redis.hset(:
|
173
|
+
Resque.redis.hset(:schedules, "new_ivar_job", Resque.encode(
|
174
174
|
{'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp/3"}
|
175
175
|
))
|
176
|
-
Resque.redis.hset(:
|
176
|
+
Resque.redis.hset(:schedules, "stay_put_job", Resque.encode(
|
177
177
|
{'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp"}
|
178
178
|
))
|
179
179
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brianjlandau-resque-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 53
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 10
|
9
|
-
-
|
10
|
-
version: 1.10.
|
9
|
+
- 5
|
10
|
+
version: 1.10.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben VandenBos
|