除非另有说明,否则我希望所有入队调用都默认为某个队列,因此它是干燥的并且更易于维护。为了指定一个队列,文档说要在类中定义一个变量@queue = X。所以,我尝试执行以下操作,但没有成功,有什么想法吗?
class ResqueJob
class << self; attr_accessor :queue end
@queue = :app
end
class ChildJob < ResqueJob
def self.perform
end
end
Resque.enqueue(ChildJob)
Resque::NoQueueError: Jobs must be placed onto a queue.
from /Library/Ruby/Gems/1.8/gems/resque-1.10.0/lib/resque/job.rb:44:in `create'
from /Library/Ruby/Gems/1.8/gems/resque-1.10.0/lib/resque.rb:206:in `enqueue'
from (irb):5