http_retriable 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -3,8 +3,10 @@
3
3
  HttpRetriable is designed to catch routine http errors and retry the provided
4
4
  block that makes network calls.
5
5
 
6
- By default, requests are tried 5 times with an exponential backoff to prevent
7
- thrashing a service that may need a few seconds to recover.
6
+ By default, requests are tried 5 times with an exponential backoff to
7
+ prevent thrashing a service that may need a few seconds to recover. It
8
+ will retry your call twice without a sleep before backing off and
9
+ retrying again. The number of quick retries is configurable.
8
10
 
9
11
  You can optionally provide a constant amount of time to sleep between retries
10
12
  and provide the number of times to retry the request if 5 retries doesn't suit
@@ -44,9 +46,10 @@ end
44
46
 
45
47
  ### Options
46
48
  You can provide several options:
47
- * retries - Integer: The number of times to retry the request
48
- * sleep - Integer: The number of seconds to sleep
49
- * exceptions - Array: List of exceptions classes
49
+ * retries - Integer: The number of times to retry the request
50
+ * quick_retries - Integer: The number of times to retry the request without backing off.
51
+ * sleep - Integer: The number of seconds to sleep
52
+ * exceptions - Array: List of exceptions classes
50
53
 
51
54
  ```ruby
52
55
  def get_funny_cats(id)
@@ -21,10 +21,10 @@ module HttpRetriable
21
21
  should_sleep = options.fetch(:sleep, false)
22
22
  backoff = !should_sleep # if sleep is provided by the user, don't backoff
23
23
  exceptions = options.fetch(:exceptions, default_exceptions)
24
+ quick_retries = options.fetch(:quick_retries, 2)
24
25
 
25
26
  retried = 0
26
27
  seconds_to_sleep = should_sleep ? should_sleep : 2
27
- quick_retries = 2
28
28
  begin
29
29
  yield
30
30
  rescue *exceptions => e
@@ -1,3 +1,3 @@
1
1
  module HttpRetriable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_retriable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-25 00:00:00.000000000 Z
12
+ date: 2014-01-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Catches common http exceptions and retries your block
15
15
  email:
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  version: '0'
50
50
  requirements: []
51
51
  rubyforge_project:
52
- rubygems_version: 1.8.25
52
+ rubygems_version: 1.8.23
53
53
  signing_key:
54
54
  specification_version: 3
55
55
  summary: ''