From 19c637eb33a41f78320aacb3b53e12a8dd249d49 Mon Sep 17 00:00:00 2001 From: "Aswin Dev P.S" Date: Fri, 8 Jul 2022 15:09:06 +0530 Subject: [PATCH] chore: Fix sentry issues (#4940) Fixes: #4810 --- app/jobs/inboxes/fetch_imap_emails_job.rb | 4 +++- app/mailboxes/mailbox_helper.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/inboxes/fetch_imap_emails_job.rb b/app/jobs/inboxes/fetch_imap_emails_job.rb index 2b77d068c..6a30562e8 100644 --- a/app/jobs/inboxes/fetch_imap_emails_job.rb +++ b/app/jobs/inboxes/fetch_imap_emails_job.rb @@ -9,8 +9,10 @@ class Inboxes::FetchImapEmailsJob < ApplicationJob fetch_mail_for_channel(channel) # clearing old failures like timeouts since the mail is now successfully processed channel.reauthorized! - rescue Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError + rescue Errno::ECONNREFUSED, Net::OpenTimeout, Net::IMAP::NoResponseError, Errno::ECONNRESET, Errno::ENETUNREACH, Net::IMAP::ByeResponseError channel.authorization_error! + rescue EOFError => e + Rails.logger.error e rescue StandardError => e ChatwootExceptionTracker.new(e, account: channel.account).capture_exception end diff --git a/app/mailboxes/mailbox_helper.rb b/app/mailboxes/mailbox_helper.rb index 6aaf4fde3..f0abc0eba 100644 --- a/app/mailboxes/mailbox_helper.rb +++ b/app/mailboxes/mailbox_helper.rb @@ -35,7 +35,7 @@ module MailboxHelper def create_contact @contact_inbox = ::ContactBuilder.new( - source_id: "email:#{processed_mail.message_id}", + source_id: processed_mail.original_sender, inbox: @inbox, contact_attributes: { name: identify_contact_name,