Add: setup clearing of expired tokens

This commit is contained in:
Aroy-Art 2025-06-30 16:01:24 +02:00
parent 828c46b27c
commit 433a783c3a
Signed by: Aroy
GPG key ID: DB9689E9391DD156
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,12 @@
from celery import shared_task
from django.core.management import call_command
@shared_task
def flush_expired_tokens():
"""Flush expired tokens using Django's call_command"""
try:
call_command("flushexpiredtokens")
return "Successfully flushed expired tokens"
except Exception as e:
return f"Error flushing tokens: {str(e)}"