README.md in take2-0.0.5 vs README.md in take2-0.1.0
- old
+ new
@@ -28,11 +28,16 @@
retriable_condition proc { |error| error.response.code < 500 }
# Defines callable code to run before next retry. Could be an out put to some logger.
on_retry proc { |error, tries| puts "#{self.name} - Retrying.. #{tries} of #{self.retriable_configuration[:retries]} (#{error})" }
- sleep_before_retry 3.3
+ # The available strategies are:
+ # type :constant, start: 2 => [2, 2, 2, 2 ... ]
+ # type :linear, start: 3, factor: 2 => [3, 6, 12, 24 ... ]
+ # type :fibonacci, start: 2 => [2, 3, 5, 8, 13 ... ]
+ # type :exponential, start: 3 => [3, 7, 12, 28, 47 ... ]
+ backoff_strategy type: :fibonacci, start: 3
def call_boy
call_api_with_retry do
# Some logic that might raise..
# If it will raise retriable, magic happens.
@@ -43,11 +48,11 @@
end
# Pass custom options per method call
# The class defaults will not be overwritten
def kill_baldur
- call_api_with_retry(retries: 2, retriable: [IOError], retry_proc: proc {}, retry_condition_proc: proc {}, time_to_sleep: 1.11) do
+ call_api_with_retry(retries: 2, retriable: [IOError], retry_proc: proc {}, retry_condition_proc: proc {}) do
# Some logic that might raise..
end
end
end
@@ -86,7 +91,8 @@
IOError
].freeze
config.retry_condition_proc = proc {false}
config.time_to_sleep = nil
config.retry_proc = proc {Rails.logger.info "Retry message"}
+ config.backoff_intervals = Take2::Backoff.new(:linear, 1).intervals
end
```
\ No newline at end of file