问题描述
我在 Rails 应用程序中使用 resque 和 resque-scheduler.我在使用 resque-scheduler 时遇到了奇怪的问题.一旦使用执行"方法完成,我的工作之一就不会从队列中删除.我需要明确地杀死它以退出队列,然后队列中的其他作业开始执行.
I am using resque, and resque-scheduler in my rails application. I am facing strange problem in using resque-scheduler. One of my job is not getting removed from queue, once it finishes with the 'perform' method. I need to kill it explicitly to get out of the queue, then other jobs in the queue starts executing.
作业类很简单,例如:
class FooJob
@queue = :high_volume
def self.perform
puts "FooJob#perform:"
# some method call
end
end
并且 resque_schedule.yml 包含:
And resque_schedule.yml contains:
add_jobs_from_foo:
cron: "15 * * * *"
class: FooJob
description: "enqueue jobs from Foo"
gem 版本会不会有问题?还是其他?
Can it be problem with gem versions? or any other?
推荐答案
让我们试试这个 gem "resque-status"
lets try this gem "resque-status"
获取工作状态-
status = Resque::Plugins::Status::Hash.get(job_id)
Resque::Plugins::Status::Hash.get(job_id) 对象会返回:
Resque::Plugins::Status::Hash.get(job_id) object gonna returns:
status.pct_complete #=> 0
status.status #=> 'queued'
status.queued? #=> true
status.working? #=> false
status.time #=> Time object
status.message #=> "Created at ..."
获取此 gem 并了解详细信息:https://github.com/quirkey/resque-status一个>
get this gem and for details: https://github.com/quirkey/resque-status
这篇关于resque 中的问题:完成处理后作业未从队列中移除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!