class Rage::Deferred::Metadata
Provides metadata about the current deferred task execution.
#
def attempts
-
(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
-
(Integer)- the number of retries (0 on first run, 1+ on retries)
def retries attempts - 1 end
def retrying?
-
(Boolean)- `true` if this is a retry, `false` if this is the first run
def retrying? attempts > 1 end
def will_retry?
-
(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