topic description
at present, there is a product that the user places an order to reduce inventory, the order is cancelled to increase inventory, and the backend modifies the inventory quantity. There are three different ways to do this. How about Synchronize? Database lock?
topic sources and their own ideas
I wonder if it can be achieved through database optimistic locks, but wouldn"t it be impossible if the version numbers obtained before and after operations within the same transaction are the same? Write a special method to get the version number?
do you have a boss to give me ideas?