Repeated execution of Firebase Realtime Database transaction function causing duplicate writes
0 reputation · 15 Feb 2022, 04:32 UTC
Ensure that side‑effects inside a Firebase Realtime Database transaction execute only once despite the SDK’s automatic retry mechanism.
The SDK may invoke the transaction function up to 25 times when a conflict is detected, and it does not expose a retry count or provide built‑in deduplication, leaving developers to decide whether to make the function idempotent or move side‑effects outside the transaction.
What mechanism could Firebase provide to let applications detect retry attempts without exposing internal state? Should the SDK guarantee exactly‑once execution for transaction functions, and what trade‑offs would that entail? How can developers safely structure transaction functions to avoid duplicate side‑effects while relying on automatic retries?