Skip to content

Commit e963acb

Browse files
committed
fix(data): retry marks save on seal/commit failure
Move marksChanged = false after the commit succeeds so that a failed cipher.seal or storage.commit leaves the flag true, causing the next flush to retry. Previously the flag was cleared before the async work, so a failure was silently treated as done and marks were never written again until a new invalidated() call.
1 parent 3617185 commit e963acb

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

‎packages/octane/src/data/persist.ts‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,19 @@ export function createPersistence(
359359
await storage.commit(partition, kept, remove).catch(() => {});
360360
}
361361
if (!cleared && marksChanged) {
362-
marksChanged = false;
363-
const value = await cipher.seal(devalue.stringify([...marks]), marksPartition);
364-
const meta = {
365-
key: marksPartition,
366-
size: value.length,
367-
savedAt: now,
368-
expiresAt: null,
369-
lastUsed: now,
370-
version: '',
371-
};
372-
await storage.commit(marksPartition, [{ meta, value }], []).catch(() => {});
362+
try {
363+
const value = await cipher.seal(devalue.stringify([...marks]), marksPartition);
364+
const meta = {
365+
key: marksPartition,
366+
size: value.length,
367+
savedAt: now,
368+
expiresAt: null,
369+
lastUsed: now,
370+
version: '',
371+
};
372+
await storage.commit(marksPartition, [{ meta, value }], []);
373+
marksChanged = false;
374+
} catch {}
373375
}
374376
}
375377

0 commit comments

Comments
 (0)