From 8af815ee608069aa12ebd7070093a2b029101312 Mon Sep 17 00:00:00 2001 From: xmk23333 Date: Thu, 15 Jan 2026 18:41:59 +0800 Subject: [PATCH] fix: add delay in coreWatcher to avoid race condition with core self-restart --- src/main/core/manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/core/manager.ts b/src/main/core/manager.ts index eb0d95d..c2ee34a 100644 --- a/src/main/core/manager.ts +++ b/src/main/core/manager.ts @@ -85,9 +85,9 @@ export function initCoreWatcher(): void { coreWatcher = chokidar.watch(path.join(mihomoCoreDir(), 'meta-update'), {}) coreWatcher.on('unlinkDir', async () => { + // 等待核心自我更新完成,避免与核心自动重启产生竞态 + await new Promise((resolve) => setTimeout(resolve, 3000)) try { - // 等待核心自我更新完成,避免管道连接竞态 - await new Promise((resolve) => setTimeout(resolve, 2000)) await stopCore(true) await startCore() } catch (e) {