-
Notifications
You must be signed in to change notification settings - Fork 943
Retrying transactions with backoff #2063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
92d9964
to
3203431
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. skipDelaysForTimerId() LGTM!
@mikelehen I've updated the web version to also use the stubbed exponential backoff in tests to match the Android version. |
Per my Android feedback, I'd prefer go back to the skipDelaysForTimerId() approach. I'm also in favor of trying to bring JS more closely inline with Android (and probably iOS). But we can defer that discussion until the iOS port is further along. |
This reverts commit 09b095b.
Random note relating to unifying the platforms and whether to change web to run the transaction logic on the AsyncQueue or not: Right now, transactions will likely continue to retry even after you call shutdown() on the client. If we hooked the transaction code into the AsyncQueue, that would automatically be fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Glad you got this working. The AsyncQueue stuff is tricky, but I think it's good to match the other platforms. I have a few nits and an optional cleanup. But in general this is looking good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
I was trying to come up with ways to skip the timeouts in integration tests, and though I'm not a fan overwriting the AsyncQueue instead of initializing it, I couldn't find another way, since we instantiate Firestore through the public API in tests (link). The downside to doing this that the
readonly
property of_queue
in the internalFirestore
has to be removed, but there aren't many places where_queue
is accessed or set.Another option to consider is mocking out
setTimeout
within the scope of therunTransaction
call, but that seems more hacky.