Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/manelli/exponential_backoff
- Owner: manelli
- License: mit
- Created: 2014-11-01T00:54:44.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-15T06:08:50.000Z (almost 10 years ago)
- Last Synced: 2024-04-24T18:40:59.187Z (7 months ago)
- Language: Ruby
- Size: 156 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 }
```