Class: Sbmt::Outbox::RetryStrategies::ExponentialBackoff

Inherits:
Base show all
Defined in:
app/interactors/sbmt/outbox/retry_strategies/exponential_backoff.rb

Instance Method Summary collapse

Methods inherited from DryInteractor

call

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/interactors/sbmt/outbox/retry_strategies/exponential_backoff.rb', line 7

def call
  delay = backoff(item.config).interval_at(item.errors_count - 1)

  still_early = item.processed_at + delay.seconds > Time.current

  if still_early
    Failure(:skip_processing)
  else
    Success()
  end
end