From 1afc23611daaaae3d2631bc6d9dc34506524ea7e Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 14 Jul 2015 20:31:19 +0200 Subject: [PATCH] Fixed a bug in quota locking --- src/pretix/base/models.py | 4 ++-- src/pretix/base/services/orders.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pretix/base/models.py b/src/pretix/base/models.py index 96a06a164f..1e4196e967 100644 --- a/src/pretix/base/models.py +++ b/src/pretix/base/models.py @@ -1624,13 +1624,13 @@ class Order(Versionable): for quota in quotas: # Lock the quota, so no other thread is allowed to perform sales covered by this # quota while we're doing so. - if quota not in quotas_locked: + if quota.identity not in [q.identity for q in quotas_locked]: quota.lock() quotas_locked.add(quota) quota.cached_availability = quota.availability()[1] else: # Use cached version - quota = [q for q in quotas_locked if q.pk == quota.pk][0] + quota = [q for q in quotas_locked if q.identity == quota.identity][0] quota.cached_availability -= 1 if quota.cached_availability < 0: # This quota is sold out/currently unavailable, so do not sell this at all diff --git a/src/pretix/base/services/orders.py b/src/pretix/base/services/orders.py index ef8fa717a4..d64d634993 100644 --- a/src/pretix/base/services/orders.py +++ b/src/pretix/base/services/orders.py @@ -97,7 +97,7 @@ def check_positions(event, dt, positions, quotas_locked): for quota in quotas: # Lock the quota, so no other thread is allowed to perform sales covered by this # quota while we're doing so. - if quota not in quotas_locked: + if quota.identity not in [q.identity for q in quotas_locked]: quota.lock() quotas_locked.add(quota) avail = quota.availability()