Keep another process's downloads when opening a library (closes #105)
check / check (push) Successful in 34s
check / check (push) Successful in 34s
The download writer's temp files are now named .quak-<pid>-<random>.tmp. removeLeftoverTempFiles moves from the backup into the download module and deletes a .quak-*.tmp file only when the process ID in its name is no longer running; the content cache calls it at open() instead of deleting every temp file, so a download in progress in another process sharing the cache survives. The README backup layout and TODO.md are updated. Model: opus-5-5
This commit is contained in:
@@ -1563,7 +1563,13 @@ describe("writeAtomic", () => {
|
||||
// directory so that new entry is on disk too. Do the directory fsync
|
||||
// before the rename, or skip it, and a crash can lose the rename.
|
||||
expect(durabilityHook.events).toHaveLength(3);
|
||||
expect(durabilityHook.events[0]).toMatch(/^sync:w:.*\.tmp$/);
|
||||
// The temp name carries this process's ID, so a library opening the
|
||||
// same cache can tell a write in progress from a leftover.
|
||||
const tempSync = durabilityHook.events[0]!;
|
||||
expect(tempSync.startsWith(`sync:w:${dir}/`)).toBe(true);
|
||||
expect(tempSync.slice(`sync:w:${dir}/`.length)).toMatch(
|
||||
new RegExp(`^\\.quak-${process.pid}-[0-9a-f]{32}\\.tmp$`),
|
||||
);
|
||||
expect(durabilityHook.events[1]).toBe(`rename:${dest}`);
|
||||
expect(durabilityHook.events[2]).toBe(`sync:r:${dir}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user