如何销毁由 resque 工人排队的工作? [英] How to destroy jobs enqueued by resque workers?

查看:46
本文介绍了如何销毁由 resque 工人排队的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 rails-3 项目中使用 Resque 来处理计划每 5 分钟运行一次的作业.我最近做了一些事情,使这些工作的创建滚雪球般地增加,堆栈已经达到了 1000 多个工作.我解决了导致许多作业排队的问题,现在我遇到的问题是该错误创建的作业仍然存在,因此由于作业被添加到具有 1000 多个作业的队列中,因此很难测试某些内容.我似乎无法停止这些工作.我曾尝试使用 flushall 命令从 redis-cli 中删除队列,但没有奏效.我错过了什么吗?因为我似乎找不到摆脱这些工作的方法.

I'm using Resque on a rails-3 project to handle jobs that are scheduled to run every 5 minutes. I recently did something that snowballed the creation of these jobs and the stack has hit over 1000 jobs. I fixed the issue that caused that many jobs to be queued and now the problem I have is that the jobs created by the bug are still there and therefore It becomes difficult to test something since a job is added to a queue with 1000+ jobs. I can't seem to stop these jobs. I have tried removing the queue from the redis-cli using the flushall command but it didn't work. Am I missing something? coz I can't seem to find a way of getting rid of these jobs.

推荐答案

如果你弹出一个 rails 控制台,你可以运行这个代码来清除你的队列:

If you pop open a rails console, you can run this code to clear out your queue(s):

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

这篇关于如何销毁由 resque 工人排队的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆