Skip to content

Commit aa6670f

Browse files
committed
fix(server): hold file lease until cancelled writes settle
1 parent 4b527ae commit aa6670f

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎apps/server/src/workspace/WorkspaceFileSystem.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ it.layer(layerTest, { excludeTestServices: true })("WorkspaceFileSystemLive", (i
383383
() =>
384384
new Promise<void>((resolve) => {
385385
finishWrite = resolve;
386-
Deferred.doneUnsafe(started, Effect.void);
386+
queueMicrotask(() => Deferred.doneUnsafe(started, Effect.void));
387387
}),
388388
);
389389
const write = yield* service

‎apps/server/src/workspace/WorkspaceFileSystem.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ export const make = Effect.gen(function* () {
566566
);
567567
yield* Effect.tryPromise({
568568
// A symlink swapped in after the check is not followed. Windows lacks O_NOFOLLOW.
569-
// A zero-argument try keeps Effect waiting for native IO before cancellation releases the lease.
570569
try: () =>
571570
NodeFSP.writeFile(realTargetPath, input.contents, {
572571
flag:
@@ -584,7 +583,7 @@ export const make = Effect.gen(function* () {
584583
operation: "write-file",
585584
cause,
586585
}),
587-
});
586+
}).pipe(Effect.uninterruptible);
588587
yield* workspaceEntries.refresh(input.cwd);
589588
return { relativePath: target.relativePath };
590589
}),

0 commit comments

Comments
 (0)