UoaWDCC / uasc-web

Project with the University of Auckland Snowsports Club Website & Booking System. Established in 2023.
https://uasc.co.nz
6 stars 2 forks source link

[BACKEND] [WEBHOOK] Expire all other checkout sessions involving date if it takes up last spot #530

Closed bcho892 closed 4 months ago

bcho892 commented 4 months ago

Is your feature request related to a problem? Please describe.

We check if there is someone in a session for a payment on stripe, however we do not account for the possible race condition when 2+ customers could theoretically get into a checkout session for the last spot on the date.

To reduce the effect of this we implement first come first serve - that is once the last spot has been taken by someone we want to expire all checkout sessions involving that date.

Note that this is probably not going to happen, and even with this change race conditions are possible - this is just a safeguard

BEFORE MERGING