delayed_job: how to force processing of failed jobs

delayed-job, ruby-on-rails-3

Solution

You can start it manually, try

Delayed::Job.all.each { |j| j.invoke_job }

or

Delayed::Job.all.each { |j| j.payload_object.perform }

Problem

I am maintaining a rails app, on which i'm running the delayed_job gem for sending emails. I just noticed that all my delayed jobs've been failing the last few days due to a bug in the application. Now the bug is fixed and I want to process the jobs asap, but they are with already too many failed attempts, and the worker pulls them from the database with a huge delay. I've tried by updating the delayed_jobs table and set the number of attempts to a smaller number and the run_at attribute to the current time, but still didn't help. Can you tell me how can I force the worker to execute them ?

Original source