Always make explicit which tables to lock (#3058)

Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
Raphael Michel
2023-01-25 11:44:11 +01:00
committed by GitHub
parent 8ca128912e
commit 3c1f3a26cf
16 changed files with 59 additions and 34 deletions

View File

@@ -51,6 +51,7 @@ from pretix.base.signals import (
EventPluginSignal, event_copy_data, logentry_display, periodic_task,
)
from pretix.control.signals import nav_event
from pretix.helpers import OF_SELF
from pretix.plugins.sendmail.models import ScheduledMail
from pretix.plugins.sendmail.views import OrderSendView, WaitinglistSendView
@@ -187,6 +188,7 @@ def sendmail_run_rules(sender, **kwargs):
with transaction.atomic(durable=True):
m = ScheduledMail.objects.select_for_update(
of=OF_SELF,
skip_locked=connection.features.has_select_for_update_skip_locked
).filter(pk=m_id).first()
if not m or m.state not in (ScheduledMail.STATE_SCHEDULED, ScheduledMail.STATE_FAILED):