How do I clear stuck/stale Resque workers?

后端 未结 15 769
你的背包
你的背包 2020-12-07 07:22

As you can see from the attached image, I\'ve got a couple of workers that seem to be stuck. Those processes shouldn\'t take longer than a couple of seconds.

15条回答
  •  遥遥无期
    2020-12-07 07:37

    In your console:

    queue_name = "process_numbers"
    Resque.redis.del "queue:#{queue_name}"
    

    Otherwise you can try to fake them as being done to remove them, with:

    Resque::Worker.working.each {|w| w.done_working}
    

    EDIT

    A lot of people have been upvoting this answer and I feel that it's important that people try hagope's solution which unregisters workers off a queue, whereas the above code deletes queues. If you're happy to fake them, then cool.

提交回复
热议问题