Fixed a bug in quota locking

This commit is contained in:
Raphael Michel
2015-07-14 20:31:19 +02:00
parent 89bad60621
commit 1afc23611d
2 changed files with 3 additions and 3 deletions

View File

@@ -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

View File

@@ -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()