Skip to content

Commit

Permalink
Add variables for the retry max and delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Serman committed Nov 23, 2015
1 parent 4a1be0a commit 7181cd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/elbas/retryable.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Elbas
module Retryable

def with_retry(max: 3, delay: 5)
def with_retry(max: fetch(:elbas_retry_max, 3), delay: fetch(:elbas_retry_delay, 5))
tries ||= 0
tries += 1
yield
rescue => e
p "Rescued #{e.message}"
if tries < max
p "Retrying..."
p "Retrying in #{delay} seconds..."
sleep delay
retry
end
Expand Down
2 changes: 1 addition & 1 deletion lib/elbas/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Elbas
VERSION = '0.18.0'
VERSION = '0.19.0'
end

0 comments on commit 7181cd3

Please sign in to comment.