diff options
author | Azul <azul@riseup.net> | 2014-01-03 11:57:31 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2014-01-03 14:50:04 +0100 |
commit | 10807e06165bb78261b9da0f5e44666c56c1f8f2 (patch) | |
tree | c35fdee5ecdee69fd3084a1d09f20ae819c2bf16 /lib | |
parent | 32409f06920cfa2eb9e23deb74c3e09db677fe77 (diff) |
better debug loggin, sleep before retrying
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tapicero/user_database.rb | 13 |
1 files changed, 7 insertions, 6 deletions
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? |