Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let the server manage/make transactions to avoid sync errors #40

Open
devj3ns opened this issue Sep 13, 2021 · 0 comments
Open

Let the server manage/make transactions to avoid sync errors #40

devj3ns opened this issue Sep 13, 2021 · 0 comments

Comments

@devj3ns
Copy link
Owner

devj3ns commented Sep 13, 2021

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.

@devj3ns 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant