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.
@@ -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 "`schedule`" key in redis (namespaced to the Resque namespace) with a JSON encoded version of the schedule hash will cause the schedule to be updated.
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.4"
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"]
@@ -40,7 +40,7 @@ module ResqueScheduler
40
40
  end
41
41
 
42
42
  def get_schedule
43
- redis.hgetall(:schedule).tap do |h|
43
+ redis.hgetall(:schedules).tap do |h|
44
44
  h.each do |name, config|
45
45
  h[name] = decode(config)
46
46
  end
@@ -19,7 +19,7 @@ module ResqueScheduler
19
19
  end
20
20
 
21
21
  get "/schedule" do
22
- Resque.reload_schedule! if Resque.respond_to?(:reload_schedule!)
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
@@ -1,3 +1,3 @@
1
1
  module ResqueScheduler
2
- Version = '1.10.4'
2
+ Version = '1.10.5'
3
3
  end
@@ -7,7 +7,7 @@ class Resque::SchedulerTest < Test::Unit::TestCase
7
7
  end
8
8
 
9
9
  def setup
10
- Resque.redis.del(:schedule)
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(:schedule, "some_ivar_job", Resque.encode(
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(:schedule)
91
- Resque.redis.hset(:schedule, "some_ivar_job2", Resque.encode(
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(:schedule, "some_ivar_job", Resque.encode(
136
+ Resque.redis.hset(:schedules, "some_ivar_job", Resque.encode(
137
137
  {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
138
138
  ))
139
- Resque.redis.hset(:schedule, "new_ivar_job", Resque.encode(
139
+ Resque.redis.hset(:schedules, "new_ivar_job", Resque.encode(
140
140
  {'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp/3"}
141
141
  ))
142
- Resque.redis.hset(:schedule, "stay_put_job", Resque.encode(
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(:schedule, "some_ivar_job", Resque.encode(
170
+ Resque.redis.hset(:schedules, "some_ivar_job", Resque.encode(
171
171
  {'cron' => "* * * * *", 'class' => 'SomeIvarJob', 'args' => "/tmp/2"}
172
172
  ))
173
- Resque.redis.hset(:schedule, "new_ivar_job", Resque.encode(
173
+ Resque.redis.hset(:schedules, "new_ivar_job", Resque.encode(
174
174
  {'cron' => "* * * * *", 'class' => 'SomeJob', 'args' => "/tmp/3"}
175
175
  ))
176
- Resque.redis.hset(:schedule, "stay_put_job", Resque.encode(
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: 55
4
+ hash: 53
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 10
9
- - 4
10
- version: 1.10.4
9
+ - 5
10
+ version: 1.10.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben VandenBos