fix: add delay in coreWatcher to avoid race condition with core self-restart

This commit is contained in:
xmk23333 2026-01-15 18:41:59 +08:00
parent fdb57431ba
commit 8af815ee60

View File

@ -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) {