fix(kanban): recover from quota exhaustion

req: sync/015
This commit is contained in:
slhx agent
2026-07-13 15:31:07 +02:00
parent bf10d1e3ce
commit 9b80444484
3 changed files with 184 additions and 10 deletions
+16 -8
View File
@@ -67,6 +67,10 @@ function stableSession() {
async function appendReorder(database, wire) {
const transaction = database.transaction([COMMANDS, META], "readwrite");
const done = completed(transaction);
const completion = done.then(
() => null,
(error) => error,
);
const meta = transaction.objectStore(META);
const commands = transaction.objectStore(COMMANDS);
const actorRequest = result(meta.get("actor"));
@@ -85,14 +89,18 @@ async function appendReorder(database, wire) {
eventKind: String(wire[1] || "click"),
key: wire[4] ? String(wire[4]) : null,
};
meta.put(actor, "actor");
meta.put(causal, "causal");
const append = result(commands.add(command));
const counted = result(commands.count());
const completion = done.then(
() => null,
(error) => error,
);
let append;
let counted;
try {
meta.put(actor, "actor");
meta.put(causal, "causal");
append = result(commands.add(command));
counted = result(commands.count());
} catch (error) {
transaction.abort();
await completion;
throw error;
}
try {
const [, count] = await Promise.all([append, counted]);
const transactionError = await completion;