resque 1.17.1 및 resque-scheduler 2.0.0.0d를 사용하여 레일 3.0.9의 컨텍스트입니다. https://github.com/bvandenbos/resque-scheduler/tree/v2.0.0.d에서 문서를 따라하려고 , 나는 resque_scheduler.rake 파일을 만들었습니다rails 3.0.9 resque-scheduler 및 지연된 작업 오류가 정의되지 않은 메소드 enqueue_at
# 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('your_resque_schedule.yml')
# If your schedule already has +queue+ set for each job, you don't
# need to require your jobs. This can be an advantage since it's
# less code that resque-scheduler needs to know about. But in a small
# project, it's usually easier to just include you job classes here.
# So, someting like this:
#require 'jobs'
# 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
시간 동안 내가 지연 작업에만 관심있는이, 그래서 어떤 resque_schedule.yml 파일이없는 . resque로 작업자 클래스를 테스트했으며 정상적으로 작동합니다. 내가 ... 내 컨트롤러에
def do_delay_job user_id,delay
Resque.enqueue_at(delay.minutes.from_now, JobDelayer, :user_id => user_id)
#Resque.enqueue(JobDelayer, user_id) # using basic resque mechanism.
end
을 지연 및 사용자 enqueue_at을 추가하려고하면 ... 그냥이 문제가 이해 될 것이다 알아 내기 위해
undefined method `enqueue_at' for Resque Client connected to redis://127.0.0.1:6379/0:Module
어떤 단서 나 힌트를 실패합니다.