Class: Conductor::Worker::Events::PollFailure

Inherits:
TaskRunnerEvent show all
Defined in:
lib/conductor/worker/events/task_runner_events.rb

Overview

Published when polling fails

Instance Attribute Summary collapse

Attributes inherited from TaskRunnerEvent

#task_type

Attributes inherited from ConductorEvent

#timestamp

Instance Method Summary collapse

Constructor Details

#initialize(task_type:, duration_ms:, cause:) ⇒ PollFailure

Returns a new instance of PollFailure.

Parameters:

  • task_type (String)

    Task definition name

  • duration_ms (Float)

    Duration of poll in milliseconds

  • cause (Exception)

    The exception that caused the failure



60
61
62
63
64
# File 'lib/conductor/worker/events/task_runner_events.rb', line 60

def initialize(task_type:, duration_ms:, cause:)
  super(task_type: task_type)
  @duration_ms = duration_ms
  @cause = cause
end

Instance Attribute Details

#causeException (readonly)

Returns The exception that caused the failure.

Returns:

  • (Exception)

    The exception that caused the failure



55
56
57
# File 'lib/conductor/worker/events/task_runner_events.rb', line 55

def cause
  @cause
end

#duration_msFloat (readonly)

Returns Duration of poll in milliseconds.

Returns:

  • (Float)

    Duration of poll in milliseconds



53
54
55
# File 'lib/conductor/worker/events/task_runner_events.rb', line 53

def duration_ms
  @duration_ms
end

Instance Method Details

#to_hObject



66
67
68
69
70
71
72
# File 'lib/conductor/worker/events/task_runner_events.rb', line 66

def to_h
  super.merge(
    duration_ms: @duration_ms,
    cause: @cause.class.name,
    cause_message: @cause.message
  )
end