Skip to content

manelli/exponential_backoff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Exponential Backoff

Simple Exponential Backoff in Ruby


Installation

$ gem install exponential_backoff

Usage

require 'exponential_backoff'

ExponentialBackoff.try(3) do
  res = HTTP.get(url)
  fail if res.error?
end

# or

begin
  ExponentialBackoff.try(2) { HTTP.get('www.google.com') }
rescue => e
  e.errors # => [#<RuntimeError: Blah>, #<ConnectionError: Bleh>]
end

API

ExponentialBackoff.try(max_number_of_tries) { request }

About

Simple Exponential Backoff

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages