From 10807e06165bb78261b9da0f5e44666c56c1f8f2 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 3 Jan 2014 11:57:31 +0100 Subject: better debug loggin, sleep before retrying --- lib/tapicero/user_database.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/tapicero/user_database.rb b/lib/tapicero/user_database.rb index a905756..c499850 100644 --- a/lib/tapicero/user_database.rb +++ b/lib/tapicero/user_database.rb @@ -67,20 +67,21 @@ module Tapicero def retry_request_once(action) second_try ||= false yield - rescue RestClient::Exception => e + rescue RestClient::Exception => exc if second_try - log_error action + " failed twice due to:", e + log_error action + " failed twice due to:", exc else - log_error action + " failed due to:", e + log_error action + " failed due to:", exc + sleep 5 second_try = true retry end end - def log_error(message, e) + def log_error(message, exc) Tapicero.logger.warn message if message - Tapicero.logger.warn e.to_s - Tapicero.logger.debug e.backtrace + Tapicero.logger.warn exc.to_s + Tapicero.logger.debug exc.backtrace.join("\n") end def secured? -- cgit v1.2.3