How to prevent race condition in online hotel booking

前端 未结 2 1034
猫巷女王i
猫巷女王i 2020-12-15 01:24

I am writing a hotel booking software using PHP and MySQL. I am pretty much done with it but I ran into a race condition problem. For example there is only one standard room

2条回答
  •  醉酒成梦
    2020-12-15 01:46

    I would also go with the pending state. You could save the state together with the session id of this user and have a cronjob that deletes all pending states that have expired session ids associated to them.

提交回复
热议问题