Reputation: 2091
I am trying to use resque-scheduler gem to schedule jobs I installed the gem (V 2.0.0d) and followed the info written on github this is my resque.rake file
# Resque tasks
require 'resque/tasks'
require 'resque_scheduler/tasks'
namespace :resque do
task :setup do
require 'resque'
require 'resque_scheduler'
require 'resque/scheduler'
# you probably already have this somewhere
Resque.redis = 'localhost:6379'
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
Resque::Scheduler.dynamic = true
end
end
but every time I run rake resque:scheduler
it says
Loading Schedule Schedule empty! Set Resque.schedule Schedules Loaded
If I remove Resque::Scheduler.dynamic = true
the schedule gets loaded correctly but I need to set this option as the schedule changes over time
Upvotes: 0
Views: 2425
Reputation: 444
You can fix this by placing the following code:
Resque::Scheduler.dynamic = true
just above the following:
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")
For more information, have a look at https://github.com/bvandenbos/resque-scheduler/issues/115
Upvotes: 3