MCPcopy Index your code
hub / github.com/coder/mux / runProjectForkExclusive

Method runProjectForkExclusive

src/node/services/taskService.ts:2592–2610  ·  view source on GitHub ↗
(projectPath: string, fn: () => Promise<T>)

Source from the content-addressed store, hash-verified

2590 }
2591
2592 private async runProjectForkExclusive<T>(projectPath: string, fn: () => Promise<T>): Promise<T> {
2593 assert(projectPath.length > 0, "runProjectForkExclusive requires projectPath");
2594
2595 const previousLaunch =
2596 this.reservedTaskLaunchByProjectPath.get(projectPath) ?? Promise.resolve();
2597 const run = previousLaunch.catch(() => undefined).then(fn);
2598 const trackedLaunch = run
2599 .then(
2600 () => undefined,
2601 () => undefined
2602 )
2603 .finally(() => {
2604 if (this.reservedTaskLaunchByProjectPath.get(projectPath) === trackedLaunch) {
2605 this.reservedTaskLaunchByProjectPath.delete(projectPath);
2606 }
2607 });
2608 this.reservedTaskLaunchByProjectPath.set(projectPath, trackedLaunch);
2609 return await run;
2610 }
2611
2612 private async materializeReservedTaskWorkspace(
2613 plan: TaskLaunchPlan,

Callers 1

Calls 5

resolveMethod · 0.80
setMethod · 0.80
getMethod · 0.65
assertFunction · 0.50
deleteMethod · 0.45

Tested by

no test coverage detected