Skip to content
Source
Sign inSign up
pingdotgg/t3code

Fix worktree removal timing out on large install trees #3902

Mergedjakeleventhal(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/3902/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 53 additions and 1 deletion.

x
0 of 2 viewed, 2 left
45 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -1489,6 +1489,51 @@
+ it.effect("allows worktree removal to run longer than the default command timeout", () =>
+ Effect.gen(function* () {
+ const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
+ const removalStarted = yield* Deferred.make<void>();
+ const delayedRemovalSpawner = ChildProcessSpawner.make((command) =>
+ Effect.gen(function* () {
+ if (
+ ChildProcess.isStandardCommand(command) &&
+ command.args[0] === "worktree" &&
+ command.args[1] === "remove"
+ ) {
+ yield* Deferred.succeed(removalStarted, undefined);
+ yield* Effect.sleep("31 seconds");
+ }
+ return yield* delegate.spawn(command);
+ }),
+ );
+ const driver = yield* makeGitVcsDriverCore().pipe(
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, delayedRemovalSpawner),
+ Effect.provide(ServerConfigLayer),
+ );
+ const cwd = yield* makeTmpDir();
+ const { initialBranch } = yield* initRepoWithCommit(cwd);
+ const fileSystem = yield* FileSystem.FileSystem;
+ const pathService = yield* Path.Path;
+ const worktreePath = pathService.join(yield* makeTmpDir("git-worktrees-"), "slow-removal");