We're using Firebase as a backend for our mobile app. Some of our users have sporadically received an error "maxretry" with a transaction writing to a path with single numeric value. We don't have multiple users or connections, nor multiple writes to the same path, as far as I know. What might be causing this?
I have a suspicion that this is caused by using floating point values with many decimal places. This error happened to me locally once and I was able to resolve it by limiting the precision to two decimal places. Can this be it?
-Albert
Edit:
Here's the code that is causing this:
return fireRef.child(fbPath).transaction(function(originalVal) {
return func(originalVal, by_value);
}, _.noop, false)
where in this case the func
looks like this:
function(originalVal, val) {
return val + (originalVal || 0);
}
The problem persisted even after limiting precision to 2 decimals (getting maxretry
error every once in a while).
It looks like when updating a value using Firebase transactions floating point type should not be used at all.
I moved to using integers and haven't had the problem anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With