Class: ExpRetry
- Inherits:
-
Object
- Object
- ExpRetry
- Defined in:
- lib/exp_retry.rb
Overview
Exponential backoff retry wrapper
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(retries: 3, exception: StandardError) ⇒ ExpRetry
constructor
A new instance of ExpRetry.
Constructor Details
#initialize(retries: 3, exception: StandardError) ⇒ ExpRetry
Returns a new instance of ExpRetry.
5 6 7 8 |
# File 'lib/exp_retry.rb', line 5 def initialize(retries: 3, exception: StandardError) @retries = retries @exception = exception end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 |
# File 'lib/exp_retry.rb', line 10 def call yield if block_given? rescue *@exception => e check(e) retry end |