lib/resque/plugins/retry.rb
# Resque on_failure hook
#
# Checks if our retry criteria is valid, if it is we try again.
# Otherwise the retry attempt count is deleted from Redis.
#
# @note This hook will only allow execution once per job perform attempt.
#       This was added because Resque v1.20.0 calls the hook twice.
#       IMO; this isn't something resque-retry should have to worry about!
#
# @api private
Resque on_failure hook
Checks if our retry criteria is valid, if it is we try again.
Otherwise the retry attempt count is deleted from Redis.
Resque on_failure hook Checks if our retry criteria is valid if it is we try again . Otherwise the retry attempt count is deleted from Redis .
def on_failure_retry(exception, *args)
        if exception.kind_of?(Resque::DirtyExit)
          @retry_attempt = Resque.redis.get(redis_retry_key(*args)).to_i
        elsif @on_failure_retry_hook_already_called
          return
        end
        if retry_criteria_valid?(exception, *args)
          try_again(exception, *args)
        else
          Resque.logger.error("The job has failed with #{exception} error, but we are not going to retry it.")
          clean_retry_key(*args)
        end
        @on_failure_retry_hook_already_called = true
      end
def on_failure_retry ( exception , * args ) if exception . kind_of? ( Resque :: DirtyExit ) @retry_attempt = Resque . redis . get ( redis_retry_key ( * args ) ) . to_i elsif @on_failure_retry_hook_already_called return end if retry_criteria_valid? ( exception , * args ) try_again ( exception , * args ) else Resque . logger . error ( "The job has failed with #{exception} error, but we are not going to retry it." ) clean_retry_key ( * args ) end @on_failure_retry_hook_already_called = true end
Resque on_failure hook
Checks if our retry criteria is valid, if it is we try again.
Resque on_failure hook Checks if our retry criteria is valid if it is we try again .
# This hook is called from a worker processes, not the job process # that failed with a DirtyExit, so @retry_attempt wasn't set yet
exception
<not_specific>
args
<not_specific>
note
This hook will only allow execution once per job perform attempt. This was added because Resque v1.20.0 calls the hook twice. IMO; this isn't something resque-retry should have to worry about!
This hook will only allow execution once per job perform attempt . This was added because Resque v1 . 20 . 0 calls the hook twice . IMO ; this isn ' t something resque - retry should have to worry about!
api
None