fix: ignore deleted workspaces in global stats (#6973)

Fixes #6568.
This commit is contained in:
Kyle Carberry
2023-04-03 09:46:09 -05:00
committed by GitHub
parent aa43f998d4
commit 2d051094e7
2 changed files with 6 additions and 6 deletions

View File

@ -7423,7 +7423,7 @@ WITH workspaces_with_jobs AS (
build_number DESC
LIMIT
1
) latest_build ON TRUE
) latest_build ON TRUE WHERE deleted = false
), pending_workspaces AS (
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
started_at IS NULL
@ -7431,8 +7431,8 @@ WITH workspaces_with_jobs AS (
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
started_at IS NOT NULL AND
canceled_at IS NULL AND
updated_at - INTERVAL '30 seconds' < NOW() AND
completed_at IS NULL
completed_at IS NULL AND
updated_at - INTERVAL '30 seconds' < NOW()
), running_workspaces AS (
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
completed_at IS NOT NULL AND