Class: ConfigOMat::Op::WaitRetry

Inherits:
LifecycleVM::OpBase
  • Object
show all
Defined in:
lib/config_o_mat/configurator/op/wait_retry.rb

Instance Method Summary collapse

Instance Method Details

#callObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/config_o_mat/configurator/op/wait_retry.rb', line 25

def call
  # Exponential backoff
  wait = retry_wait * (2**(retry_count - retries_left))

  # With jitter
  wait += rand(retry_wait + 1) - (retry_wait / 2.0)

  logger&.notice(:retry_wait, wait: wait)

  # Calling Kernel.sleep directly for easy test stubbing
  Kernel.sleep wait

  self.retries_left -= 1
end