You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes multiple transactions take place in a short timeframe. With the current implementation, it can happen that some transactions are 'lost' or overwritten by others because the client manipulates the state of the game instead of the server.
It would be better to store the transactions in a sub collection of the game object in the database. (This would also make it easier to set the timestamp to FieldValue.serverTimeStamp because it is not nested anymore.)
Then a cloud function could detect the creation of new queued transactions and manipulates the player's balance in the game state object accordingly.
When that (the transaction) is done, it can update the status of the transaction and show that in the UI.
The text was updated successfully, but these errors were encountered:
devj3ns
changed the title
Fix multiple transactions at the same time or short after another
Let the server manage/make transactions to avoid sync errors
Apr 16, 2023
Sometimes multiple transactions take place in a short timeframe. With the current implementation, it can happen that some transactions are 'lost' or overwritten by others because the client manipulates the state of the game instead of the server.
It would be better to store the transactions in a sub collection of the game object in the database. (This would also make it easier to set the timestamp to
FieldValue.serverTimeStamp
because it is not nested anymore.)Then a cloud function could detect the creation of new queued transactions and manipulates the player's balance in the game state object accordingly.
When that (the transaction) is done, it can update the status of the transaction and show that in the UI.
The text was updated successfully, but these errors were encountered: