From 7181cd3e4b15fd137a81b21b90c5d9742f166e29 Mon Sep 17 00:00:00 2001 From: Logan Serman Date: Mon, 23 Nov 2015 17:51:28 -0600 Subject: [PATCH] Add variables for the retry max and delay --- lib/elbas/retryable.rb | 4 ++-- lib/elbas/version.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/elbas/retryable.rb b/lib/elbas/retryable.rb index b55ca30..30ea049 100644 --- a/lib/elbas/retryable.rb +++ b/lib/elbas/retryable.rb @@ -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 diff --git a/lib/elbas/version.rb b/lib/elbas/version.rb index f31d1a1..d8ba617 100644 --- a/lib/elbas/version.rb +++ b/lib/elbas/version.rb @@ -1,3 +1,3 @@ module Elbas - VERSION = '0.18.0' + VERSION = '0.19.0' end