Fix: Invalid staticmethod decorator

This commit is contained in:
Adrià Casajús 2023-07-11 12:25:05 +02:00
parent 516072fd99
commit 6979c5c598
No known key found for this signature in database
GPG Key ID: F0033226A5AFC9B9
1 changed files with 5 additions and 3 deletions

View File

@ -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",