Class: JetstreamBridge::ExponentialBackoffStrategy

Inherits:
RetryStrategy
  • Object
show all
Defined in:
lib/jetstream_bridge/core/retry_strategy.rb

Overview

Exponential backoff retry strategy

Instance Method Summary collapse

Methods inherited from RetryStrategy

#execute

Constructor Details

#initialize(max_attempts: 3, base_delay: 0.1, max_delay: 60, multiplier: 2, transient_errors: [], jitter: true) ⇒ ExponentialBackoffStrategy



75
76
77
78
79
80
81
82
# File 'lib/jetstream_bridge/core/retry_strategy.rb', line 75

def initialize(max_attempts: 3, base_delay: 0.1, max_delay: 60, multiplier: 2, transient_errors: [], jitter: true)
  @base_delay = base_delay
  @max_delay = max_delay
  @multiplier = multiplier
  @jitter = jitter
  backoffs = compute_backoffs(max_attempts)
  super(max_attempts: max_attempts, backoffs: backoffs, transient_errors: transient_errors)
end