From 0fbbdceec2ef66a350a49a2305ec134caffc400f Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Mon, 4 Dec 2023 13:37:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=8C=E6=9C=BA=E4=B8=BB=E5=A4=87?= =?UTF-8?q?=E9=83=A8=E7=BD=B2sftp=E5=A4=87=E4=BB=BD=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/notifications.py | 6 +++--- apps/common/tasks.py | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/accounts/notifications.py b/apps/accounts/notifications.py index b650410d1..eb4548d12 100644 --- a/apps/accounts/notifications.py +++ b/apps/accounts/notifications.py @@ -1,7 +1,7 @@ from django.template.loader import render_to_string from django.utils.translation import gettext_lazy as _ -from common.tasks import send_mail_attachment_async, upload_backup_to_obj_storage +from common.tasks import send_mail_attachment, upload_backup_to_obj_storage from notifications.notifications import UserMessage from users.models import User from terminal.models.component.storage import ReplayStorage @@ -27,7 +27,7 @@ class AccountBackupExecutionTaskMsg(object): "to set the encryption password").format(name) def publish(self, attachment_list=None): - send_mail_attachment_async( + send_mail_attachment( self.subject, self.message, [self.user.email], attachment_list ) @@ -70,7 +70,7 @@ class ChangeSecretExecutionTaskMsg(object): "file encryption password to set the encryption password").format(name) def publish(self, attachments=None): - send_mail_attachment_async( + send_mail_attachment( self.subject, self.message, [self.user.email], attachments ) diff --git a/apps/common/tasks.py b/apps/common/tasks.py index d5c0cb609..8af5e17b6 100644 --- a/apps/common/tasks.py +++ b/apps/common/tasks.py @@ -45,8 +45,7 @@ def send_mail_async(*args, **kwargs): logger.error("Sending mail error: {}".format(e)) -@shared_task(verbose_name=_("Send email attachment"), activity_callback=task_activity_callback) -def send_mail_attachment_async(subject, message, recipient_list, attachment_list=None): +def send_mail_attachment(subject, message, recipient_list, attachment_list=None): if attachment_list is None: attachment_list = [] from_email = settings.EMAIL_FROM or settings.EMAIL_HOST_USER @@ -66,7 +65,6 @@ def send_mail_attachment_async(subject, message, recipient_list, attachment_list logger.error("Sending mail attachment error: {}".format(e)) -@shared_task(verbose_name=_('Upload session replay to external storage')) def upload_backup_to_obj_storage(recipient, upload_file): logger.info(f'Start upload file : {upload_file}') remote_path = os.path.join('account_backup', os.path.basename(upload_file))