我正在尝试使用resque-scheduler gem来调度作业我安装了gem (V2.0.0d)并遵循了github上写入的信息这是我的resque.rake文件
# 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但是每次我运行rake resque:scheduler的时候它都会说
加载日程安排为空!设置已加载的Resque.schedule计划
如果我删除Resque::Scheduler.dynamic = true,计划将正确加载,但我需要设置此选项,因为计划会随着时间的推移而变化
发布于 2012-02-08 23:30:05
您可以通过放置以下代码来修复此问题:
Resque::Scheduler.dynamic = true就在以下内容之上:
Resque.schedule = YAML.load_file("#{Rails.root}/config/resque_schedule.yml")有关更多信息,请查看https://github.com/bvandenbos/resque-scheduler/issues/115
https://stackoverflow.com/questions/7182196
复制相似问题