How to avoid Race condition in Appsheet?

I am creating an app on the Seating Management for our offices. Admin can set number of seats for any specific location and employee can book that many number of seat (first come first serve basis)
Now in order to ensure there is no overbooking, I am doing the following,

  1. Check Office Capacity value that Admin has configured
  2. Check already booked record count for one particular day
  3. Subtract (1-2)
  4. If 3 is greater than 0 then only I am allowing new entries, so far so good.

Now the issue arises when multiple users are accessing the App simultaneously.
Assume only 1 place is left for the location and 3 users are accessing the App simultaneosuly. All 3 will see 1 place left and can book the same as there is no validation happening on Actual Save (Submit) form event.

Any thoughts on how to resolve this?

For Tech-Savvy friends : โ€˜How to avoid race condition in Appsheet?โ€™

1 5 301
5 REPLIES 5
Top Labels in this Space