mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-10 19:50:28 +08:00
fix: add delay in coreWatcher to avoid race condition with core self-restart
This commit is contained in:
parent
fdb57431ba
commit
8af815ee60
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user