fix: add pre-restart delay to prevent MCP server failures on plugin updates
Add 2-second delay before worker restart in ensureWorkerVersionMatches() to give files time to sync. Fixes issue where MCP server would fail after plugin updates because restart happened too quickly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ export const HOOK_TIMEOUTS = {
|
||||
HEALTH_CHECK: 1000, // Worker health check (up from 500ms)
|
||||
WORKER_STARTUP_WAIT: 1000,
|
||||
WORKER_STARTUP_RETRIES: 15,
|
||||
PRE_RESTART_SETTLE_DELAY: 2000, // Give files time to sync before restart
|
||||
WINDOWS_MULTIPLIER: 1.5 // Platform-specific adjustment
|
||||
} as const;
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ async function ensureWorkerVersionMatches(): Promise<void> {
|
||||
workerVersion
|
||||
});
|
||||
|
||||
// Give files time to sync before restart
|
||||
await new Promise(resolve => setTimeout(resolve, getTimeout(HOOK_TIMEOUTS.PRE_RESTART_SETTLE_DELAY)));
|
||||
|
||||
// Restart the worker
|
||||
await ProcessManager.restart(getWorkerPort());
|
||||
|
||||
@@ -142,7 +145,7 @@ async function ensureWorkerVersionMatches(): Promise<void> {
|
||||
logger.error('SYSTEM', 'Worker failed to restart after version mismatch', {
|
||||
expectedVersion: pluginVersion,
|
||||
runningVersion: workerVersion,
|
||||
port
|
||||
port: getWorkerPort()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user