Class: Fractor::Workflow::ConstantDelay

Inherits:
RetryStrategy show all
Defined in:
lib/fractor/workflow/retry_strategy.rb

Overview

Constant delay retry strategy

Instance Attribute Summary collapse

Attributes inherited from RetryStrategy

#max_attempts, #max_delay

Instance Method Summary collapse

Constructor Details

#initialize(delay: 1, **options) ⇒ ConstantDelay

Returns a new instance of ConstantDelay.



70
71
72
73
# File 'lib/fractor/workflow/retry_strategy.rb', line 70

def initialize(delay: 1, **options)
  super(**options)
  @delay = delay
end

Instance Attribute Details

#delayObject (readonly)

Returns the value of attribute delay.



68
69
70
# File 'lib/fractor/workflow/retry_strategy.rb', line 68

def delay
  @delay
end

Instance Method Details

#delay_for(attempt) ⇒ Object



75
76
77
78
79
# File 'lib/fractor/workflow/retry_strategy.rb', line 75

def delay_for(attempt)
  return 0 if attempt <= 1

  cap_delay(delay)
end