From be8f94143f92eb3d457a977cd81e323fbec300d6 Mon Sep 17 00:00:00 2001 From: Denozordec Date: Thu, 20 Aug 2026 16:07:24 +0700 Subject: [PATCH] =?UTF-8?q?fix(health):=20=D0=BD=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=B0=D1=82=D1=8C=20=D0=B3=D1=80=D0=B0=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=20uptime=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BE=D0=B9=20?= =?UTF-8?q?down=20=D0=B2=20=D1=82=D0=BE=D0=BC=20=D0=B6=D0=B5=20=D0=B1?= =?UTF-8?q?=D0=B0=D0=BA=D0=B5=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Если в минутном бакете есть живой IP, линия строится по его пингу, а не по null от Down. Co-authored-by: Cursor --- .../components/reui-kit/uptime-chart.test.ts | 22 +++++++++++++++++++ .../src/components/reui-kit/uptime-chart.tsx | 9 ++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/reui-kit/uptime-chart.test.ts b/apps/web/src/components/reui-kit/uptime-chart.test.ts index b7e9155..f204ac5 100644 --- a/apps/web/src/components/reui-kit/uptime-chart.test.ts +++ b/apps/web/src/components/reui-kit/uptime-chart.test.ts @@ -45,6 +45,28 @@ describe('toAlignedSeries', () => { expect(keys).toEqual(['local', 'cloudflare', 'globalping']) }) + it('keeps live latency when another IP in the same bucket is down', () => { + const { points } = toAlignedSeries([ + probe({ + id: 1, + latency_ms: 18, + checked_at: '2026-01-01T00:00:10.000Z', + }), + probe({ + id: 2, + status: 'down', + ok: false, + latency_ms: null, + checked_at: '2026-01-01T00:00:12.000Z', + }), + ]) + + expect(points).toHaveLength(1) + expect(points[0]?.local).toBe(18) + expect(points[0]?.localOk).toBe(true) + expect(points[0]?.ok).toBe(true) + }) + it('does not plot down probes as latency 0', () => { const { points } = toAlignedSeries([ probe({ diff --git a/apps/web/src/components/reui-kit/uptime-chart.tsx b/apps/web/src/components/reui-kit/uptime-chart.tsx index 293b4cd..126a76e 100644 --- a/apps/web/src/components/reui-kit/uptime-chart.tsx +++ b/apps/web/src/components/reui-kit/uptime-chart.tsx @@ -124,8 +124,13 @@ export function toAlignedSeries(items: UptimeProbe[]): { } const ok = probeOk(item) - row[`${key}Ok`] = ok - row[key] = ok ? item.latency_ms : null + const prevOk = row[`${key}Ok`] + row[`${key}Ok`] = prevOk === true || ok + if (ok && item.latency_ms != null) { + row[key] = item.latency_ms + } else if (row[key] === undefined) { + row[key] = null + } } const points = [...buckets.entries()]