class Zenaton::Contexts::Task
Represents the current runtime context of a Task
.
The information provided by the context can be useful to alter the behaviour of the task.
For example, you can use the attempt index to know if a task has been automatically retried or not and how many times, and decide to do something when you did not expect the task to be retried more than X times.
You can also use the attempt number in the `on_error_retry_delay` method of a task in order to implement complex retry strategies.
Attributes
id[R]
@return [String] The UUID identifying the current task
retry_index[R]
@return [Integer] The number of times this task has been automatically
retried. This counter is reset if you issue a manual retry from your dashboard
Public Class Methods
new(**kwargs)
click to toggle source
@return [Zenaton::Contexts::Task] a new execution context for a task
# File lib/zenaton/contexts/task.rb, line 27 def initialize(**kwargs) @id = kwargs[:id] @retry_index = kwargs[:retry_index] end