From e121462c58d7d27ee73e0091e0ef04631d418e53 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Mon, 16 Apr 2007 22:59:57 +0000 Subject: [PATCH] retry on imap ssl errors and better logging git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@381 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- lib/sup/imap.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index d5ee887..f79befb 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -34,7 +34,7 @@ class IMAP < Source SCAN_INTERVAL = 60 # seconds ## upon these errors we'll try to rereconnect a few times - RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT ] + RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT, OpenSSL::SSL::SSLError ] attr_accessor :username, :password @@ -233,15 +233,17 @@ private begin unsafe_connect unless @imap yield - rescue *RECOVERABLE_ERRORS + rescue *RECOVERABLE_ERRORS => e if (retries += 1) <= 3 @imap = nil + Redwood::log "got #{e.class.name}: #{e.message.inspect}" + sleep 2 retry end raise end rescue SocketError, Net::IMAP::Error, SystemCallError, IOError, OpenSSL::SSL::SSLError => e - raise FatalSourceError, "While communicating with IMAP server (type #{e.class.name}): #{e.message}" + raise FatalSourceError, "While communicating with IMAP server (type #{e.class.name}): #{e.message.inspect}" end end -- 2.45.2