Would love to see unique constraints at the db level, but short of that…
What does everybody do to work-around race conditions? Specifically, I am dealing with webhooks coming into bubble at a rapid rate and I’m getting dupes in the creation of new things (that have a only when condition looking for dupes.)
Eventbrite uses a web hook to alert us when event tickets are purchased. Let’s say Ted buys 10 tickets. The web hook is fired off 10 times, one for each attendee.
We receive the hook and retrieve the attendee and create a contact if the attendee is not already in the contacts table.
Often, but not always, Ted does not specify attendee contact information, so all 10 attendees are “Ted”. I end up with multiple records for Ted.
While race conditions are not unique to bubble, they often can be managed with the database and unique constraints. Since that is not an option, I’m wondering how the creative bubble mind is getting around this.
The best I have is to generate a random number within a range and add that number of seconds to the current time and schedule an API endpoint for each hook processing. It feels like a hack that is vulnerable under load without getting too extreme with the delay.
Looking to learn from any ideas that have worked for others.