Class: RetryDecorator

Inherits:
Decorator show all
Defined in:
lib/retry_decorator.rb

Overview

Simple retry decorator

Instance Method Summary collapse

Methods included from DecoratorDsl

#after, #around, #before, extended

Constructor Details

#initialize(tries:, from: StandardError, backoff: false, sleep_duration: -1)) ⇒ RetryDecorator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds a new RetryDecorator

Parameters:

  • tries (Integer)

    Number of retries to make

  • from (Class) (defaults to: StandardError)

    Exception class to recsue from

  • backoff (Boolean) (defaults to: false)

    Whether or not sleep between retries

  • sleep_duration (Integer) (defaults to: -1))

    starting sleep value to increment



17
18
19
20
21
22
# File 'lib/retry_decorator.rb', line 17

def initialize(tries:, from: StandardError, backoff: false, sleep_duration: -1)
  @tries = tries
  @from = from
  @backoff = backoff
  @sleep_duration = sleep_duration
end