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

@@ -8,7 +8,15 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _
@shared_task(verbose_name=_('Clean expired session'))
@shared_task(
verbose_name=_('Clean expired session'),
description=_(
"""
Since user logins create sessions, the system will clean up expired sessions every 24
hours
"""
)
)
@register_as_period_task(interval=3600 * 24)
def clean_django_sessions():
Session.objects.filter(expire_date__lt=timezone.now()).delete()