Reputation: 2129
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
.
Upvotes: 1
Views: 860
Reputation: 2129
So dequeue
is used by the client to manually dequeue
jobs from Redis/Resque. To calculate the time a job spends in the queue, I will have to capture the time in after_enqueue
and before_perform
. When Resque pops a job off the queue, there is no hook that we can hook into.
Upvotes: 1