Skip to content

Fix out-of-order execution for enqueueRetryable #3919

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

Merged
merged 2 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/long-hornets-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need a patch for the firebase-wide package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we don't need to for a patch release, since every release is at least a minimum patch version bump.

---

Fixed a potential issue in our internal queue that could have allowed API calls to be executed out of order.
6 changes: 4 additions & 2 deletions packages/firestore/src/util/async_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ export class AsyncQueue {
* operations were retried successfully.
*/
enqueueRetryable(op: () => Promise<void>): void {
this.retryableOps.push(op);
this.enqueueAndForget(() => this.retryNextOp());
this.enqueueAndForget(() => {
this.retryableOps.push(op);
return this.retryNextOp();
});
}

/**
Expand Down