I have a server and hundreds of B4A/B4I clients.
Clients consume "virtual credits" during operations and communicate this value to the server, so that a MySql table is updated with the new credit.
The flow is something like this:
Now, suppose we are at point 3 in the server and another client communicates its consumed credits to the server, suppose the value is 10.
I suppose a new session of the server handler is started, right ?
What happens if the first handler is not completed and the second handler still read 100 from the DB ?
When everything will be finished, will be the final value in the DB always 85 or may happens 90 ?
Clients consume "virtual credits" during operations and communicate this value to the server, so that a MySql table is updated with the new credit.
The flow is something like this:
- Client A consumes 5 credits and posts this value to the B4J server that receive it through a server handler.
- Server handler receive the value 5
- Server make a DbQuery and read the current value of the credit, suppose it is 100
- Server subtract 5 from the credits and store in the DB the new value 95
- Server send an OK to the client
Now, suppose we are at point 3 in the server and another client communicates its consumed credits to the server, suppose the value is 10.
I suppose a new session of the server handler is started, right ?
What happens if the first handler is not completed and the second handler still read 100 from the DB ?
When everything will be finished, will be the final value in the DB always 85 or may happens 90 ?