resque-status 参数错误
我有一个非常基本的 Sinatra 应用程序来测试 resque-status
需要“sinatra/base”
需要“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
在状态选项卡中,我可以看到该作业有 1 个参数:
SleepJob({"length"=>100})
但状态设置为失败,并显示消息:
The task failed because of an error: wrong number of arguments (0 for 1)
有人知道问题是什么吗?
谢谢。
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</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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论