Search code examples
ruby-on-railsdelayed-job

How to check if the delayed job is actually retrying


I have the following method

def max_attempts
  3
end

But I want to check if Internet is not there, or the third party connection I am establishing is not available. I want delayed job to retry it. I have switched off internet, but I cannot see Delayed::Job getting populated.


Solution

  • You can check:

    Delayed::Job.find(id).attempts
    

    attempts should show you haw many attempts it tried to do and if it reached the maximum it will stop trying.

    Make sure you are not catching the error some where, otherwise the Delayed job will think its success and will be removed from the table.