alf.io
alf.io copied to clipboard
Refactoring: do not preallocate tickets if not necessary
Currently "limited seats" ticket category pre-allocates tickets in order to ensure that the number of seats chosen won't be taken by other categories. That was a good mechanism in the past, but since the introduction of the "admin reservation" is become obsolete and could mislead the organizer.
The solution would be to apply a "best effort" allocation strategy, instead of pre-allocating the tickets. As a result, since we need to count already reserved tickets in order to avoid overbooking, a lock on the category (select for update) would be required before reserving tickets