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

Inherits:
DryInteractor
  • Object
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



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

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

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

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