class Rage::Deferred::Metadata


Provides metadata about the current deferred task execution.
#

def attempts

Returns:
  • (Integer) - the current attempt number (1 for the first run)
def attempts
  Rage::Deferred::Context.get_attempts(context).to_i + 1
end

def context

def context
  Fiber[Rage::Deferred::Task::CONTEXT_KEY]
end

def retries

Returns:
  • (Integer) - the number of retries (0 on first run, 1+ on retries)
def retries
  attempts - 1
end

def retrying?

Returns:
  • (Boolean) - `true` if this is a retry, `false` if this is the first run
def retrying?
  attempts > 1
end

def will_retry?

Returns:
  • (Boolean) - `true` if a failure will schedule another attempt, `false` otherwise
def will_retry?
  task = Rage::Deferred::Context.get_task(context)
  task.__should_retry?(attempts)
end