fix
This commit is contained in:
@@ -131,6 +131,8 @@ export async function loadMonitors(pageId: string, window: Window): Promise<Moni
|
||||
// silently broken), aggregate directly from pings. Bounded by the window so
|
||||
// it stays cheap. Once the rollup catches up this branch never fires.
|
||||
if (rollupRows.length === 0) {
|
||||
// Group/order by ordinals — Postgres won't dedupe a $-parameterised
|
||||
// date_trunc() between SELECT and GROUP BY otherwise.
|
||||
rollupRows = await sql<any[]>`
|
||||
SELECT
|
||||
monitor_id,
|
||||
@@ -141,8 +143,8 @@ export async function loadMonitors(pageId: string, window: Window): Promise<Moni
|
||||
FROM pings
|
||||
WHERE monitor_id = ANY(${sql.array(ids)}::text[])
|
||||
AND checked_at > date_trunc(${truncUnit}, now()) - ${intervalLiteral}::interval
|
||||
GROUP BY monitor_id, date_trunc(${truncUnit}, checked_at)
|
||||
ORDER BY monitor_id, bucket_start ASC
|
||||
GROUP BY 1, 2
|
||||
ORDER BY 1, 2 ASC
|
||||
`;
|
||||
}
|
||||
// Index actual rollup data by (monitor_id, isoBucketStart) so we can fill in
|
||||
|
||||
Reference in New Issue
Block a user