Replies: 1 comment 1 reply
-
Have you tried this? https://beanie-odm.dev/tutorial/revision/ But I prefer using Redis lock. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a game that keeps it's game state in mongo, and clients update that game state through websocket messages. My problem is, that the clients sometimes sends their actions at the exact same time resulting in the gamestate being overwritten by one of them. I think this happens because I run FastApi with multiple workers, so if one workers does a .find .save action it does not know that another worker is doing the same thing. I have somewhat solved it using a redis Lock, such that a lock must be aquired before doing work on a document. This works, but it's not pretty. Is there a better way to solve this issue?
Beta Was this translation helpful? Give feedback.
All reactions