我有一个非常基本的Sinatra应用程序来测试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</a>'
out << '</form>'
out << "</body></html>"
out
end
post '/sleep' do
job_id = SleepJob.create(:length => 100)
redirect "/resque/"
end
end
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</a>'
out << '</form>'
out << "</body></html>"
out
end
post '/sleep' do
job_id = SleepJob.create(:length => 100)
redirect "/resque/"
end
end
在状态选项卡中,我可以看到该作业有一个参数:
但状态设置为失败,显示消息:
SleepJob({"length"=>100})
任何人都知道这是什么问题?
感谢。