Use celery tasks instead of systemd timers for periodic work; and add more tests
All checks were successful
Deploy to Server / deploy (push) Successful in 26s

This commit is contained in:
Joakim Hellsén 2026-04-08 03:23:18 +02:00
commit 66ea46cf23
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
25 changed files with 2133 additions and 104 deletions

View file

@ -8,7 +8,8 @@ from twitch.models import Channel
if TYPE_CHECKING:
from argparse import ArgumentParser
from debug_toolbar.panels.templates.panel import QuerySet
from django.db.models import QuerySet
SAMPLE_PREVIEW_COUNT = 10

View file

@ -193,8 +193,8 @@ class Command(BaseCommand):
img.mode == "P" and "transparency" in img.info
):
# Create white background for transparency
background = Image.new("RGB", img.size, (255, 255, 255))
rgba_img = img.convert("RGBA") if img.mode == "P" else img
background: Image.Image = Image.new("RGB", img.size, (255, 255, 255))
rgba_img: Image.Image = img.convert("RGBA") if img.mode == "P" else img
background.paste(
rgba_img,
mask=rgba_img.split()[-1] if rgba_img.mode in {"RGBA", "LA"} else None,

View file

@ -17,9 +17,16 @@ logger: logging.Logger = logging.getLogger("ttvdrops.watch_imports")
class Command(BaseCommand):
"""Watch for JSON files in a directory and import them automatically."""
"""Watch for JSON files in a directory and import them automatically.
help = "Watch a directory for JSON files and import them automatically"
.. deprecated::
This command is superseded by the Celery Beat task
``twitch.tasks.scan_pending_twitch_files`` (runs every 10 s via
``ttvdrops-celery-beat.service``). Keep this command for ad-hoc use
or in environments that run without a Celery worker.
"""
help = "Watch a directory for JSON files and import them automatically (superseded by Celery Beat)"
requires_migrations_checks = True
def add_arguments(self, parser: CommandParser) -> None: