I have built a simple system to let people get an event ticket on-line.
The db table (let’s call it Tickets) has been pre-populated with all of the available tickets. So my db looks something like this:
ticket # - purchaser’s email
1 - empty
2 - empty
…and so on, usually up to only 50.
When a timer runs out, the user can click the “give me a ticket” button.
The button finds the first item in Tickets where the purchaser’s email is empty, and then sets the value of the purchaser’s email to the current user’s email address.
This all works great.
But, of course, everyone wants ticket #1. And I have had a couple of cases where TWO users get #1. I can see why: they are both, at the exact same time, looking for the first available ticket, and Bubble sees #1 as the first available, and gives BOTH users #1.
I’m not talking about thousands of users either. I typically only give out maybe 10-40 tickets per event. I even checked my logs and one particular even peaked at a non-impressive 48 workflow executions.
Any ideas? Am I doing something that’s obviously wrong and just not seeing it? I do set the values of several custom states to disable the button and display informational messages, but I don’t think any that is slowing things down, or maybe they are.