fix: too optimized
This commit is contained in:
parent
530e37c581
commit
981ed965a8
|
|
@ -194,10 +194,11 @@ export const dashboard = new Elysia()
|
|||
// and easy to reason about.
|
||||
const pingResults = await Promise.all(
|
||||
monitors.map((m: any) => sql`
|
||||
SELECT * FROM pings
|
||||
SELECT id, checked_at, latency_ms, up, region
|
||||
FROM pings
|
||||
WHERE monitor_id = ${m.id}
|
||||
ORDER BY checked_at DESC
|
||||
LIMIT 20
|
||||
LIMIT 60
|
||||
`)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@
|
|||
if (!sparkData[mid].regions[region]) sparkData[mid].regions[region] = [];
|
||||
sparkData[mid].regions[region].push(ping.latency_ms);
|
||||
sparkData[mid].timeline.push(region);
|
||||
if (sparkData[mid].regions[region].length > 20) sparkData[mid].regions[region].shift();
|
||||
if (sparkData[mid].timeline.length > 40) sparkData[mid].timeline.shift();
|
||||
if (sparkData[mid].regions[region].length > 60) sparkData[mid].regions[region].shift();
|
||||
if (sparkData[mid].timeline.length > 120) sparkData[mid].timeline.shift();
|
||||
redrawSparkline(card, mid);
|
||||
const { latest } = getBestRegion(mid);
|
||||
if (latest != null) card.querySelector('.stat-latency').textContent = latest + 'ms';
|
||||
|
|
|
|||
Loading…
Reference in New Issue