perf(watchers): skip startup for canceled runtime requests (#35556)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-10-28 19:32:26 -07:00
committed by GitHub
co-authored by OrcaWin
parent 005da54a15
commit 3bd8670091
+3 -3
View File
@@ -256,6 +256,9 @@ export async function watchFileExplorerInWatcherProcess(
onTerminalError: (error: Error) => void = () => undefined,
signal?: AbortSignal
): Promise<() => Promise<void>> {
if (signal?.aborted) {
throw createRuntimeRootAbortError()
}
const existingRoot = runtimeRootWatches.get(rootPath)
if (existingRoot?.closed) {
if (!existingRoot.closePromise) {
@@ -263,9 +266,6 @@ export async function watchFileExplorerInWatcherProcess(
}
// Join the prior generation's physical release before reusing its native root.
await existingRoot.closePromise
if (signal?.aborted) {
throw createRuntimeRootAbortError()
}
return watchFileExplorerInWatcherProcess(rootPath, callback, onTerminalError, signal)
}
const root = existingRoot ?? createRuntimeRootWatch(rootPath)