From 809513440096cafc38b0d292c04ecb7bc3fb3bf2 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 7 Jul 2026 14:55:32 +0200 Subject: [PATCH] Add query tagging for periodic tasks --- src/pretix/base/management/commands/runperiodic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/management/commands/runperiodic.py b/src/pretix/base/management/commands/runperiodic.py index ff9b31fc6..400497520 100644 --- a/src/pretix/base/management/commands/runperiodic.py +++ b/src/pretix/base/management/commands/runperiodic.py @@ -41,6 +41,7 @@ from django.core.management.base import BaseCommand from django.db import close_old_connections from django.dispatch.dispatcher import NO_RECEIVERS +from django_querytagger.tagging import with_tag from pretix.helpers.periodic import SKIPPED from ...signals import periodic_task @@ -82,7 +83,8 @@ class Command(BaseCommand): try: # Check if the DB connection is still good, it might be closed if the previous task took too long. close_old_connections() - r = receiver(signal=periodic_task, sender=self) + with with_tag(f"periodictask={name}"): + r = receiver(signal=periodic_task, sender=self) except Exception as err: if isinstance(err, KeyboardInterrupt): raise err