From e30e436051f8bfddc3ae8080d40fa8ebe14a8fb5 Mon Sep 17 00:00:00 2001 From: altair823 Date: Sat, 2 May 2026 01:34:33 +0900 Subject: [PATCH] =?UTF-8?q?feat(ollama):=20main=20wiring=20=E2=80=94=20hea?= =?UTF-8?q?lth.start=20+=20before-quit=20stop=20(#1=20v0.2.3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 0abca87..c551b9a 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -69,8 +69,22 @@ app.whenReady().then(async () => { fromEnv: process.env.INKLING_OLLAMA_ENDPOINT !== undefined }); const provider = new LocalOllamaProvider({ endpoint: resolvedEndpoint }); - const health = new HealthChecker(provider); - void health.runOnce().then((h) => logger.info('ai.health', { ...h } as Record)); + const health = new HealthChecker(provider, { + onUpdate: (status) => { + logger.info('ai.health', { ...status } as Record); + // pushOllamaStatus 추가는 Task 4 에서 — helper 부재 시점. + }, + onTelemetry: (ev) => { + if (ev.kind === 'ollama_unreachable') { + void telemetry.emit({ kind: 'ollama_unreachable', payload: { reason: ev.reason } }).catch(() => {}); + } else if (ev.kind === 'ollama_recovered') { + void telemetry.emit({ kind: 'ollama_recovered', payload: { downtimeMs: ev.downtimeMs } }).catch(() => {}); + } else if (ev.kind === 'ollama_recheck_manual') { + void telemetry.emit({ kind: 'ollama_recheck_manual', payload: {} }).catch(() => {}); + } + } + }); + health.start(); const worker = new AiWorker(repo, provider, { onUpdate: (note) => { @@ -128,6 +142,7 @@ app.whenReady().then(async () => { let backupOnQuitDone = false; app.on('before-quit', (e) => { + health.stop(); if (backupOnQuitDone) return; e.preventDefault(); backup.runDaily()