fix(web): refine OpenCode health monitoring

This commit is contained in:
Bohdan Triapitsyn
2026-01-14 00:25:23 +02:00
parent 279efb28b3
commit 0d43725802
+4 -4
View File
@@ -1886,11 +1886,11 @@ function startHealthMonitoring() {
} }
healthCheckInterval = setInterval(async () => { healthCheckInterval = setInterval(async () => {
if (!openCodeProcess || isShuttingDown) return; if (!openCodeProcess || isShuttingDown || isRestartingOpenCode) return;
try { try {
const healthy = await isOpenCodeProcessHealthy();
if (openCodeProcess.exitCode !== null) { if (!healthy) {
console.log('OpenCode process not running, restarting...'); console.log('OpenCode process not running, restarting...');
await restartOpenCode(); await restartOpenCode();
} }
@@ -1976,7 +1976,7 @@ async function main(options = {}) {
status: 'ok', status: 'ok',
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
openCodePort: openCodePort, openCodePort: openCodePort,
openCodeRunning: Boolean(openCodeProcess && openCodeProcess.exitCode === null), openCodeRunning: Boolean(openCodePort && isOpenCodeReady && !isRestartingOpenCode),
openCodeApiPrefix, openCodeApiPrefix,
openCodeApiPrefixDetected, openCodeApiPrefixDetected,
isOpenCodeReady, isOpenCodeReady,