使用 Resque 和 ResqueScheduler 对重复发生的作业进行排队。我在 rails 3.2.6, resque 1.21.0, resque-scheduler 2.0.0h
当调度程序启动时,我收到以下错误,在显示调度选项卡时也遇到问题(在遵循 doco 之后):
rake resque:scheduler --trace ** 调用 resque:scheduler (first_time) ** 调用 resque:scheduler_setup (first_time) ** 执行 resque:scheduler_setup ** 调用 resque:setup (first_time) ** 调用环境 (first_time) ** 执行环境 ** 执行 resque:setup ** 执行 resque:scheduler 2012-07-07 23:55:56 加载计划 2012-07-07 23:55:56 调度 run_pinpro_copy 2012-07-07 23:55:56 调度 CancelAbandonedOrders 2012 -07-07 23:55:56 加载时间表 2012-07-07 23:56:30 排队测试 (run_database_copy) 2012-07-07 23:56:30 NoMethodError: 未定义的方法 `run_before_delayed_enqueue_hooks' 用于 ResqueScheduler::Plugin:Module
resque_scheduler.yml
CancelAbandonedOrders:
cron: "*/5 * * * *"
run_database_copy:
cron: "30 * * * * *"
class: Testing
queue: testing_queue
args:
description: "Copy PinPro views to local tables"
testing.rb(工人)
class Testing
@queue = :testing_queue
def self.perform
puts "Running Job!"
end
end
resque.rb
require 'resque_scheduler'
Resque.schedule = YAML.load_file(File.join(Rails.root, 'config/resque_scheduler.yml'))
resque_scheduler.rake
# Resque tasks
require 'resque/tasks'
require 'resque_scheduler/tasks'
require 'resque_scheduler/server'
task "resque:setup" => :environment
namespace :resque do
task :setup do
require 'resque'
require 'resque_scheduler'
require 'resque/scheduler'
require 'resque_scheduler/server'
# you probably already have this somewhere
Resque.redis = 'localhost:6379'
end
end
任何示例/建议将不胜感激。