Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust for https://github.com/pretix/pretix/pull/2408/ #3

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pretix_vacc_autosched/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pretix.base.email import get_email_context
from pretix.base.i18n import language
from pretix.base.models import Order, OrderPosition, Quota
from pretix.base.services.locking import LockTimeoutException
from pretix.base.services.locking import LockTimeoutException, lock_objects
from pretix.base.services.mail import SendMailException, TolerantDict
from pretix.base.services.tasks import EventTask
from pretix.base.signals import order_paid, order_placed
Expand Down Expand Up @@ -156,7 +156,8 @@ def schedule_second_dose(self, event, op):

def book_second_dose(*, op, item, variation, subevent, original_event):
event = item.event
with event.lock(), transaction.atomic():
with transaction.atomic():
lock_objects([event])
avcode, avnr = item.check_quotas(subevent=subevent, fail_on_no_quotas=True)
if avcode != Quota.AVAILABILITY_OK:
logger.info(f"SECOND DOSE: cannot use slot {subevent.pk}, sold out")
Expand Down
Loading