Exception: Amigo::Retry::Retry

Inherits:
Error
  • Object
show all
Defined in:
lib/amigo/retry.rb

Overview

Raise this class, or a subclass of it, to schedule a later retry, rather than using an error to trigger Sidekiq’s default retry behavior. The benefit here is that it allows a consistent, customizable behavior, so is better for ‘expected’ errors like rate limiting.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interval_or_timestamp, msg = nil) ⇒ Retry

Returns a new instance of Retry.



39
40
41
42
43
# File 'lib/amigo/retry.rb', line 39

def initialize(interval_or_timestamp, msg=nil)
  @interval_or_timestamp = interval_or_timestamp
  @wrapped = exc?(msg)
  super(exc_or_msg("retry job in #{interval_or_timestamp.to_i}s", msg))
end

Instance Attribute Details

#interval_or_timestampObject

Returns the value of attribute interval_or_timestamp.



37
38
39
# File 'lib/amigo/retry.rb', line 37

def interval_or_timestamp
  @interval_or_timestamp
end

#wrappedObject

Returns the value of attribute wrapped.



37
38
39
# File 'lib/amigo/retry.rb', line 37

def wrapped
  @wrapped
end