From 6979c5c5986b0c03859f45d8f2665ec00f984c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Tue, 11 Jul 2023 12:25:05 +0200 Subject: [PATCH] Fix: Invalid staticmethod decorator --- app/mail_sender.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/mail_sender.py b/app/mail_sender.py index 12b60ee9..01436524 100644 --- a/app/mail_sender.py +++ b/app/mail_sender.py @@ -77,7 +77,6 @@ class SendRequest: file_path = os.path.join(config.SAVE_UNSENT_DIR, file_name) self.save_request_to_file(file_path) - @staticmethod def save_request_to_failed_dir(self, prefix: str = "DeliveryRetryFail"): file_name = ( f"{prefix}-{int(time.time())}-{uuid.uuid4()}.{SendRequest.SAVE_EXTENSION}" @@ -255,8 +254,11 @@ def load_unsent_mails_from_fs_and_resend(): "DeliverUnsentEmail", {"delivered": "false"} ) except Exception as e: - # Unlink original file to avoid re-doing the same - os.unlink(full_file_path) + try: + # Unlink original file to avoid re-doing the same + os.unlink(full_file_path) + except FileNotFoundError: + pass LOG.e( "email sending failed with error:%s " "envelope %s -> %s, mail %s -> %s saved to %s",