From 3bd86700918cf0bcaba656b5d91b95e3dcf71474 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Wed, 28 Oct 2026 19:32:26 -0700 Subject: [PATCH] perf(watchers): skip startup for canceled runtime requests (#35556) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- src/main/runtime/file-watcher-host.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/runtime/file-watcher-host.ts b/src/main/runtime/file-watcher-host.ts index 980ed4fd902..e7796b9387c 100644 --- a/src/main/runtime/file-watcher-host.ts +++ b/src/main/runtime/file-watcher-host.ts @@ -256,6 +256,9 @@ export async function watchFileExplorerInWatcherProcess( onTerminalError: (error: Error) => void = () => undefined, signal?: AbortSignal ): Promise<() => Promise> { + 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)