Problem in resque: job not getting removed from queue when finished processing

落爺英雄遲暮 提交于 2020-01-16 18:02:34

问题


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.

Job class is simple, like:

                    class FooJob
                      @queue = :high_volume

                      def self.perform
                        puts "FooJob#perform:"
                        # some method call
                      end
                    end

And resque_schedule.yml contains:

                    add_jobs_from_foo:
                      cron: "15 * * * *"
                      class: FooJob
                      description: "enqueue jobs from Foo"

Can it be problem with gem versions? or any other?


回答1:


Did you actually verify by looking at redis directly? The job gets removed from the queue before perform even starts execution.




回答2:


lets try this gem "resque-status"

get job status-

status = 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 ..."

get this gem and for details: https://github.com/quirkey/resque-status



来源:https://stackoverflow.com/questions/5552743/problem-in-resque-job-not-getting-removed-from-queue-when-finished-processing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!