resque-status argument error
I have a very basic Sinatra app to test resque-status
require 'sinatra/base'
require 'resque'
require 'resque/job_with_status'
class SleepJob < Resque::JobWithStatus
def perform
total = options['length'].to_i || 1000
num = 0
while num < total
at(num, total, "At #{num} of #{total}")
sleep(1)
num += 1
end
completed
end
end
class App < Sinatra::Base
get '/' do
info = Resque.info
out = "<html><head><title>Resque Demo</title></head><body>"
out << "<p>"
out << "There are #{info[:pending]} pending and "
out << "#{info[:processed]} processed jobs across #{info[:queues]} queues."
out << "</p>"
out << "<form action='/sleep' method='POST''>"
out << '<input type="submit" value="Sleep Job"/>'
out << ' <a href="/resque/">View Resque&l开发者_StackOverflow社区t;/a>'
out << '</form>'
out << "</body></html>"
out
end
post '/sleep' do
job_id = SleepJob.create(:length => 100)
redirect "/resque/"
end
end
In the statuses tab I can see that the job has 1 argument:
SleepJob({"length"=>100})
But the status is set to failed with the message:
The task failed because of an error: wrong number of arguments (0 for 1)
Anyone knows what the issue is?
Thanks.
精彩评论