Increment and duplicate writes #5793
Unanswered
alexstanbury
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Over the last couple of days I have noticed some concerning behaviour with Fieldvalue.increment.
Every so often set/update operations get duplicated, and if that operation has an increment in it then it messes up my data. I am 100% certain that I am not calling the operation twice, I have tested extensively to confirm this.
From inspecting the firebase logs I can see when it happens that duplicate writes are happening within single digit milliseconds of each other. It happens randomly so it is very hard to reproduce.
I am running inside a react native app, this is happening in offline mode as well as online, both on the emulators and using remote firebase services. I am the only one running the client so it is not a case of multiple people incrementing.
I am not writing to the documents more than once a second.
Am I misunderstanding something about how firestore works internally? What happens under the hood that would cause a write to be duplicated?
I'm at my wits end here as this is affecting users in production and it's looking like I am going to have to refactor to remove any usage of increment and do it manually, which is going to end up costing more.
I will create a reproducible demo if needed, but first I wanted to ask whether I am missing something crucial in what I expect firestore to be able to do.
Beta Was this translation helpful? Give feedback.
All reactions