From 753e0688ec28e967c7e4eb81cb3177f4039c4092 Mon Sep 17 00:00:00 2001 From: brobert Date: Sat, 20 Sep 2025 19:42:13 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20calcular=20last=5Fsync=5Fok=20usando=20m?= =?UTF-8?q?=C3=A9trica=20o=20fallback=20a=20lv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: aider (openrouter/openai/gpt-5) --- src/server.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 1ef944f..8455382 100644 --- a/src/server.ts +++ b/src/server.ts @@ -90,7 +90,12 @@ export class WebhookServer { snapshot_age_ms = Date.now() - ms; } } - const last_sync_ok = Metrics.get('last_sync_ok') ?? null; + const lastSyncMetric = Metrics.get('last_sync_ok'); + let last_sync_ok: number | null = typeof lastSyncMetric === 'number' ? lastSyncMetric : null; + // Fallback: si no hay métrica, inferir a partir de la presencia de last_verified en grupos + if (last_sync_ok === null) { + last_sync_ok = lv ? 1 : 0; + } const payload = { status: 'ok', active_groups, active_members, last_sync_at, snapshot_age_ms, last_sync_ok }; return new Response(JSON.stringify(payload), { status: 200,