parent
2e42821c48
commit
e2059cfc5b
2 changed files with 9 additions and 1 deletions
|
@ -9,7 +9,7 @@ class Inboxes::FetchImapEmailsJob < ApplicationJob
|
||||||
fetch_mail_for_channel(channel)
|
fetch_mail_for_channel(channel)
|
||||||
# clearing old failures like timeouts since the mail is now successfully processed
|
# clearing old failures like timeouts since the mail is now successfully processed
|
||||||
channel.reauthorized!
|
channel.reauthorized!
|
||||||
rescue Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError, Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError
|
rescue *ExceptionList::IMAP_EXCEPTIONS
|
||||||
channel.authorization_error!
|
channel.authorization_error!
|
||||||
rescue EOFError => e
|
rescue EOFError => e
|
||||||
Rails.logger.error e
|
Rails.logger.error e
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require 'net/imap'
|
||||||
|
|
||||||
module ExceptionList
|
module ExceptionList
|
||||||
REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest,
|
REST_CLIENT_EXCEPTIONS = [RestClient::NotFound, RestClient::GatewayTimeout, RestClient::BadRequest,
|
||||||
RestClient::MethodNotAllowed, RestClient::Forbidden, RestClient::InternalServerError,
|
RestClient::MethodNotAllowed, RestClient::Forbidden, RestClient::InternalServerError,
|
||||||
|
@ -8,4 +10,10 @@ module ExceptionList
|
||||||
SMTP_EXCEPTIONS = [
|
SMTP_EXCEPTIONS = [
|
||||||
Net::SMTPSyntaxError
|
Net::SMTPSyntaxError
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
|
IMAP_EXCEPTIONS = [
|
||||||
|
Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError,
|
||||||
|
Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError,
|
||||||
|
SocketError
|
||||||
|
].freeze
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue