Skip to content

Commit f69df92

Browse files
committed
fix: ignore deleted workspaces in global stats
Fixes #6568.
1 parent fab8da6 commit f69df92

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

coderd/database/queries.sql.go

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

+3-3
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,16 @@ WITH workspaces_with_jobs AS (
356356
build_number DESC
357357
LIMIT
358358
1
359-
) latest_build ON TRUE
359+
) latest_build ON TRUE WHERE deleted = false
360360
), pending_workspaces AS (
361361
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
362362
started_at IS NULL
363363
), building_workspaces AS (
364364
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
365365
started_at IS NOT NULL AND
366366
canceled_at IS NULL AND
367-
updated_at - INTERVAL '30 seconds' < NOW() AND
368-
completed_at IS NULL
367+
completed_at IS NULL AND
368+
updated_at - INTERVAL '30 seconds' < NOW()
369369
), running_workspaces AS (
370370
SELECT COUNT(*) AS count FROM workspaces_with_jobs WHERE
371371
completed_at IS NOT NULL AND

0 commit comments

Comments
 (0)