Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/manelli/exponential_backoff

Simple Exponential Backoff
https://github.com/manelli/exponential_backoff

Last synced: 7 days ago
JSON representation

Simple Exponential Backoff

Awesome Lists containing this project

README

        

# Exponential Backoff
### _Simple Exponential Backoff in Ruby_
---

## Installation

$ gem install exponential_backoff

## Usage

```ruby
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 # => [#, #]
end
```

## API
```ruby
ExponentialBackoff.try(max_number_of_tries) { request }
```