Skip to content

Commit 2bea0a3

Browse files
Fix out-of-order execution for enqueueRetryable (#3919)
1 parent 6f2cf64 commit 2bea0a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/long-hornets-scream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Fixed a potential issue in our internal queue that could have allowed API calls to be executed out of order.

packages/firestore/src/util/async_queue.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,10 @@ export class AsyncQueue {
321321
* operations were retried successfully.
322322
*/
323323
enqueueRetryable(op: () => Promise<void>): void {
324-
this.retryableOps.push(op);
325-
this.enqueueAndForget(() => this.retryNextOp());
324+
this.enqueueAndForget(() => {
325+
this.retryableOps.push(op);
326+
return this.retryNextOp();
327+
});
326328
}
327329

328330
/**

0 commit comments

Comments
 (0)