我的resque工人阶级是:
require 'resque'
require 'resque/job_with_status'
class PatstatResqueWorker < Resque::JobWithStatus
@queue = :my_worker_q
def self.perform(query, label)
puts "query:"
puts options['query']
puts "label:"
puts options['label']
end
end
我的控制器部分,我称之为 resque 的地方是......
class MyController < ApplicationController
def resque
job_id = PatstatResqueWorker.create(:query => @query, :label => "yes")
status = Resque::Plugins::Status::Hash.get(job_id)
end
end
它不起作用:(如果我从resque函数中删除参数,它会说参数数量错误(0代表2),如果我添加参数部分,它会说选项未定义:(你能帮忙吗?