--- title: "Resque: how to requeue failed jobs" kind: article slug: resque-how-to-requeue-failed-jobs created_at: 2010-08-23 tags: - Ruby - resque --- Today I found about 100k Resque jobs in the _failed_ queue. Due to a small error in some user content, those jobs all failed. After fixing the problem, how do you reprocess all those jobs? Option one: go to the `resque-web` backend and click _retry_ about 100.000 times. Option two: do some cool ruby commands. ~ Resque offers you direct access to the _failed_ queue and also provides a method to `requeue` jobs. How easy can it be, right? With `Resque::Failure.all(0,1)` you retrieve the first job from the _failed_ queue. `Resque::Failure.all` is simply a ruby Array. To requeue jobs, you can use `Resque::Failure.requeue(index)` where index corresponds to the index of the job in the `Resque::Failure.all` Array. To requeue all jobs in the _failed_ queue, you can simply run the following commands: :::ruby # Requeue all jobs in the failed queue (Resque::Failure.count-1).downto(0).each { |i| Resque::Failure.requeue(i) } # Clear the failed queue Resque::Failure.clear That's all there is to it, really. Happy processing!