So I am developing a Firebase function that accepts requests from users and updates few nodes under a branch these users are listening to.
My issue is if the function receives two client requests at the same time, that triggers two functions to execute and update the data at the same time.
I know this is typically solved by a transaction, but my updates are done on various nodes not only one value (i.e counter).
In a traditional multi-threading programming, this problems is solved by locking the code from executing so it can only be executed by one thread, where the next one resumes when the current one finishes.
Is this an option in Firebase Functions? If so, how can it be done?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…