File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
app/eventyay/base/services Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -1175,15 +1175,9 @@ def _perform_order(
11751175 meta_info = meta_info ,
11761176 )
11771177
1178- lockfn = NoLockManager
1179- locked = False
1180- if positions .filter (
1181- Q (voucher__isnull = False ) | Q (expires__lt = now () + timedelta (minutes = 2 )) | Q (seat__isnull = False )
1182- ).exists ():
1183- # Performance optimization: If no voucher is used and no cart position is dangerously close to its expiry date,
1184- # creating this order shouldn't be prone to any race conditions and we don't need to lock the event.
1185- locked = True
1186- lockfn = event .lock
1178+ # Always lock the event during checkout to prevent race conditions (overselling).
1179+ # We deliberately skip the previous performance optimization here to ensure data integrity.
1180+ lockfn = event .lock
11871181
11881182 with lockfn () as now_dt :
11891183 positions = list (
@@ -1217,7 +1211,7 @@ def _perform_order(
12171211 )
12181212 if free_order_flow :
12191213 try :
1220- payment .confirm (send_mail = False , lock = not locked )
1214+ payment .confirm (send_mail = False , lock = False )
12211215 except Quota .QuotaExceededException :
12221216 pass
12231217
You can’t perform that action at this time.
0 commit comments