Exception: Amigo::Retry::OrDie
- Defined in:
- lib/amigo/retry.rb
Overview
Raise this class, or a subclass of it, to:
-
Use
Retryexception semantics while the current attempt is <=attempts, or -
Use
Dieexception semantics if the current attempt is >attempts.
Callers can provide a subclass with two methods that are looked for:
If on_retry is defined, it is called with (worker instance, job hash). If on_retry returns :skip, do NOT retry (do not send to the retry set).
If on_die is defined, it is called with (worker instance, job hash). If on_die returns :skip, do NOT send to the dead set.
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#interval_or_timestamp ⇒ Object
readonly
Returns the value of attribute interval_or_timestamp.
-
#wrapped ⇒ Object
readonly
Returns the value of attribute wrapped.
Instance Method Summary collapse
-
#initialize(attempts, interval_or_timestamp, msg = nil) ⇒ OrDie
constructor
A new instance of OrDie.
Constructor Details
#initialize(attempts, interval_or_timestamp, msg = nil) ⇒ OrDie
Returns a new instance of OrDie.
73 74 75 76 77 78 |
# File 'lib/amigo/retry.rb', line 73 def initialize(attempts, , msg=nil) @wrapped = exc?(msg) @attempts = attempts = super(exc_or_msg("retry every #{interval_or_timestamp.to_i}s up to #{attempts} times", msg)) end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
71 72 73 |
# File 'lib/amigo/retry.rb', line 71 def attempts @attempts end |
#interval_or_timestamp ⇒ Object (readonly)
Returns the value of attribute interval_or_timestamp.
71 72 73 |
# File 'lib/amigo/retry.rb', line 71 def end |
#wrapped ⇒ Object (readonly)
Returns the value of attribute wrapped.
71 72 73 |
# File 'lib/amigo/retry.rb', line 71 def wrapped @wrapped end |