Class: Rage::Deferred::DeadTask

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/deferred/dead_task.rb

Overview

Provides information about one dead task.

A dead task is a deferred task that is no longer retried. Creating this object does not load the task class. The first call to #args or #kwargs deserializes the execution context.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attempts ⇒ Integer (readonly)

Returns the number of processing attempts.

Returns:

  • (Integer) —

    the number of processing attempts



17
18
19
# File 'lib/rage/deferred/dead_task.rb', line 17

def attempts
  @attempts
end

#backtrace ⇒ Array<String> (readonly)

Returns the frozen backtrace from the last exception.

Returns:

  • (Array<String>) —

    the frozen backtrace from the last exception



32
33
34
# File 'lib/rage/deferred/dead_task.rb', line 32

def backtrace
  @backtrace
end

#enqueued_at ⇒ Time (readonly)

Returns the time when Rage enqueued the task.

Returns:

  • (Time) —

    the time when Rage enqueued the task



20
21
22
# File 'lib/rage/deferred/dead_task.rb', line 20

def enqueued_at
  @enqueued_at
end

#exception_class ⇒ String (readonly)

Returns the class name of the last exception.

Returns:

  • (String) —

    the class name of the last exception



26
27
28
# File 'lib/rage/deferred/dead_task.rb', line 26

def exception_class
  @exception_class
end

#exception_message ⇒ String (readonly)

Returns the message from the last exception.

Returns:

  • (String) —

    the message from the last exception



29
30
31
# File 'lib/rage/deferred/dead_task.rb', line 29

def exception_message
  @exception_message
end

#failed_at ⇒ Time (readonly)

Returns the time when the last attempt failed.

Returns:

  • (Time) —

    the time when the last attempt failed



23
24
25
# File 'lib/rage/deferred/dead_task.rb', line 23

def failed_at
  @failed_at
end

#id ⇒ String (readonly)

Returns the ID that Rage assigned when it enqueued the task.

Returns:

  • (String) —

    the ID that Rage assigned when it enqueued the task



11
12
13
# File 'lib/rage/deferred/dead_task.rb', line 11

def id
  @id
end

#task_class ⇒ String (readonly)

Returns the name of the task class.

Returns:

  • (String) —

    the name of the task class



14
15
16
# File 'lib/rage/deferred/dead_task.rb', line 14

def task_class
  @task_class
end

Instance Method Details

#args ⇒ Array

Return the original positional arguments.

On the first call, the method deserializes the execution context. The method freezes all objects in the decoded data. After a successful call, the method returns the same Array on each later call. If the stored value is nil, the method returns a frozen empty Array.

Returns:

  • (Array) —

    frozen positional arguments

Raises:



57
58
59
60
# File 'lib/rage/deferred/dead_task.rb', line 57

def args
  decode_context unless defined?(@__args)
  @__args
end

#kwargs ⇒ Hash

Return the original keyword arguments.

On the first call, the method deserializes the execution context. The method freezes all objects in the decoded data. After a successful call, the method returns the same Hash on each later call. If the stored value is nil, the method returns a frozen empty Hash.

Returns:

  • (Hash) —

    frozen keyword arguments

Raises:



71
72
73
74
# File 'lib/rage/deferred/dead_task.rb', line 71

def kwargs
  decode_context unless defined?(@__kwargs)
  @__kwargs
end