Notification queues: Optimize order for less queries (#5512)

* Notification queues: Optimize order for less queries

* Update src/pretix/api/webhooks.py

Co-authored-by: luelista <weller@rami.io>

---------

Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
Raphael Michel
2025-10-06 09:24:51 +02:00
committed by GitHub
parent 867cd8c59e
commit 301191e4bd
2 changed files with 12 additions and 4 deletions

View File

@@ -41,7 +41,11 @@ def notify(logentry_ids: list):
if not isinstance(logentry_ids, list):
logentry_ids = [logentry_ids]
qs = LogEntry.all.select_related('event', 'event__organizer').filter(id__in=logentry_ids)
qs = LogEntry.all.select_related(
'event', 'event__organizer'
).order_by(
'action_type', 'event_id',
).filter(id__in=logentry_ids)
_event, _at, notify_specific, notify_global = None, None, None, None
for logentry in qs: