1

I am using Resque to enqueue jobs.

I start a worker and the jobs are processed.

My jobs extend a gem that implements job hooks like before_enqueue, after_enqueue, before_perform, after_perform and sends stuff to statsd. Those work. However, before_dequeue and after_dequeue do not seem to be called. Is there a reason why?

Also, my understanding of Resque isn't all quite there. I would call Resque.enqueue to queue up a job class, and then if I start a Resque worker, it will automatically pop a task from the queue and then perform the task. Where does dequeue come into play? I notice that dequeue destroys the the task, when does the dequeue step happen in the Resque worker workflow?

I want to hook into after_dequeue because I want to log the time that a task stays in the queue, so I need to hook into before_enqueue and after_dequeue.

4

1 回答 1

1

dequeue客户端使用Sodequeue从 Redis/Resque 手动作业。要计算作业在队列中花费的时间,我必须在after_enqueue和中捕获时间before_perform。当 Resque 将作业从队列中弹出时,我们无法挂钩。

于 2013-09-23T18:17:45.960 回答