Skip to content
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

fix(@aws-amplify/datastore): Fix dequeue bug caused by undefined head #6361

Closed
Closed
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
4 changes: 3 additions & 1 deletion packages/datastore/src/sync/outbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class MutationEventOutbox {
public async dequeue(storage: StorageFacade): Promise<MutationEvent> {
const head = await this.peek(storage);

await storage.delete(head);
if (head !== undefined) {
await storage.delete(head);
}
Comment on lines +83 to +85
Copy link
Contributor

Choose a reason for hiding this comment

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

@manueliglesias Your suggestion here sounds correct to me:
#6358 (comment)

Namely, head becoming undefined sounds like a symptom of an underlying queue problem. (We can discuss this in Discord/Slack if you'd like)

Granted, this PR short-circuits the bug, so I'm happy to accept this if the "correct" solution differs & is a bigger lift.


this.inProgressMutationEventId = undefined;

Expand Down