Rename & make idempotent
This commit is contained in:
parent
9e05734c5f
commit
136514d33a
1 changed files with 4 additions and 2 deletions
|
|
@ -114,7 +114,7 @@ export class Database {
|
||||||
this.save();
|
this.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetSyncState(): void {
|
public reset(): void {
|
||||||
this.documents = [];
|
this.documents = [];
|
||||||
this.lastSeenUpdateId = 0;
|
this.lastSeenUpdateId = 0;
|
||||||
this.save();
|
this.save();
|
||||||
|
|
@ -142,7 +142,9 @@ export class Database {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (entry === undefined) {
|
if (entry === undefined) {
|
||||||
throw new Error("Document not found by update promise");
|
// This method should be idempotent and tolerant of
|
||||||
|
// stragglers calling it after the databse has been reset.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.updates = entry.updates.filter((update) => update !== promise);
|
entry.updates = entry.updates.filter((update) => update !== promise);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue