diff --git a/backend/src/integrations/uptimeKuma.ts b/backend/src/integrations/uptimeKuma.ts index 2ef162e..7922d50 100644 --- a/backend/src/integrations/uptimeKuma.ts +++ b/backend/src/integrations/uptimeKuma.ts @@ -90,6 +90,14 @@ export const uptimeKuma: IntegrationAdapter = { const latest = beats[beats.length - 1] if (latest) lastHeartbeat.set(monitorId, latest) }) + // importantHeartbeatList only contains status-change events, so a monitor + // that's been continuously up since it was added has no entries there. + // heartbeatList carries the regular (non-"important") beat history and is + // sent for every monitor, so it's needed to populate those cases too. + s.on('heartbeatList', (monitorId: number, beats: Heartbeat[]) => { + const latest = beats[beats.length - 1] + if (latest) lastHeartbeat.set(monitorId, latest) + }) s.on('heartbeat', (beat: Heartbeat & { monitorID: number }) => { lastHeartbeat.set(beat.monitorID, beat) })