From c593f91d77c8a33636083d72943873b026160196 Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Thu, 18 Sep 2025 14:55:20 +0800 Subject: [PATCH] fix: Account backup: when sending to the mailbox fails, the task status also shows the success problem. --- apps/accounts/automations/backup_account/handlers.py | 4 ++-- apps/common/tasks.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/accounts/automations/backup_account/handlers.py b/apps/accounts/automations/backup_account/handlers.py index 251a7d605..4b76f1ebb 100644 --- a/apps/accounts/automations/backup_account/handlers.py +++ b/apps/accounts/automations/backup_account/handlers.py @@ -235,8 +235,8 @@ class AccountBackupHandler: except Exception as e: error = str(e) print(f'\033[31m>>> {error}\033[0m') - self.execution.status = Status.error - self.execution.summary['error'] = error + self.manager.status = Status.error + self.manager.summary['error'] = error def backup_by_obj_storage(self): object_id = self.execution.snapshot.get('id') diff --git a/apps/common/tasks.py b/apps/common/tasks.py index f87cfd7f6..7653423cc 100644 --- a/apps/common/tasks.py +++ b/apps/common/tasks.py @@ -97,10 +97,7 @@ def send_mail_attachment_async(subject, message, recipient_list, attachment_list for attachment in attachment_list: email.attach_file(attachment) os.remove(attachment) - try: - return email.send() - except Exception as e: - logger.error("Sending mail attachment error: {}".format(e)) + return email.send() @shared_task(