perf: Add task description (#14033)

Co-authored-by: ZhaoJiSen <97007455+ZhaoJiSen@users.noreply.github.com>
This commit is contained in:
fit2bot
2024-09-09 18:54:33 +08:00
committed by GitHub
parent bd548b3fe2
commit 1417abecfb
29 changed files with 1129 additions and 148 deletions

View File

@@ -28,7 +28,15 @@ def task_activity_callback(self, subject, message, recipient_list, *args, **kwar
return resource_ids,
@shared_task(verbose_name=_("Send email"), activity_callback=task_activity_callback)
@shared_task(
verbose_name=_("Send email"),
activity_callback=task_activity_callback,
description=_(
"""
This task will be executed when sending email notifications
"""
)
)
def send_mail_async(*args, **kwargs):
""" Using celery to send email async
@@ -55,7 +63,16 @@ 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)
@shared_task(
verbose_name=_("Send email attachment"),
activity_callback=task_activity_callback,
description=_(
"""
When an account password is changed or an account backup generates attachments,
this task needs to be executed for sending emails and handling attachments
"""
)
)
def send_mail_attachment_async(subject, message, recipient_list, attachment_list=None):
if attachment_list is None:
attachment_list = []
@@ -77,7 +94,15 @@ 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'))
@shared_task(
verbose_name=_('Upload account backup to external storage'),
description=_(
"""
When performing an account backup, this task needs to be executed to external storage
(SFTP)
"""
)
)
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))

View File

@@ -13,7 +13,15 @@ from common.utils.random import random_string
logger = get_logger(__file__)
@shared_task(verbose_name=_('Send SMS code'))
@shared_task(
verbose_name=_('Send SMS code'),
description=_(
"""
When resetting a password, forgetting a password, or verifying MFA, this task needs to
be executed to send SMS messages
"""
)
)
def send_sms_async(target, code):
SMS().send_verify_code(target, code)