ttvdrops/core/tasks.py
Joakim Hellsén 66ea46cf23
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
Use celery tasks instead of systemd timers for periodic work; and add more tests
2026-04-08 03:23:18 +02:00

17 lines
498 B
Python

from __future__ import annotations
import logging
from celery import shared_task
from django.core.management import call_command
logger = logging.getLogger("ttvdrops.tasks")
@shared_task(bind=True, queue="default", max_retries=3, default_retry_delay=300)
def submit_indexnow_task(self) -> None: # noqa: ANN001
"""Submit all site URLs to the IndexNow search index."""
try:
call_command("submit_indexnow")
except Exception as exc:
raise self.retry(exc=exc) from exc