39
Views
1
Comments
Parking Space Reservation Overlap
Question

Hello 

I would like to ask for a solution for a problem where in case a two customer search a parking space reservation in same time and same parking space it should return an error for both of them. 


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Gerald,

You cannot easily produce an error for both: the problem here is that you have less resources than consumers, but you don't know while handling each consumer whether there are other consumers also being handled. (Also, functionally this is strange, why would you want both customers to leave, still having an empty parking space?)

The solution to this could be to use a lock by means of the GetForUpdate Entity Action, and only after releasing the lock checking for availability. The second customer then is put "on hold" until the lock is released (which should take only a short while), then finds there is no more space.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.