Compare commits

...

1 commit

Author SHA1 Message Date
Adrià Casajús 6979c5c598
Fix: Invalid staticmethod decorator 2023-07-11 12:25:05 +02:00

View file

@ -77,7 +77,6 @@ class SendRequest:
file_path = os.path.join(config.SAVE_UNSENT_DIR, file_name) file_path = os.path.join(config.SAVE_UNSENT_DIR, file_name)
self.save_request_to_file(file_path) self.save_request_to_file(file_path)
@staticmethod
def save_request_to_failed_dir(self, prefix: str = "DeliveryRetryFail"): def save_request_to_failed_dir(self, prefix: str = "DeliveryRetryFail"):
file_name = ( file_name = (
f"{prefix}-{int(time.time())}-{uuid.uuid4()}.{SendRequest.SAVE_EXTENSION}" 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"} "DeliverUnsentEmail", {"delivered": "false"}
) )
except Exception as e: except Exception as e:
# Unlink original file to avoid re-doing the same try:
os.unlink(full_file_path) # Unlink original file to avoid re-doing the same
os.unlink(full_file_path)
except FileNotFoundError:
pass
LOG.e( LOG.e(
"email sending failed with error:%s " "email sending failed with error:%s "
"envelope %s -> %s, mail %s -> %s saved to %s", "envelope %s -> %s, mail %s -> %s saved to %s",