Gallery-Archivist/backend/api/authentication/tasks.py

12 lines
363 B
Python

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)}"