Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 70b093f

Browse files
authored
fix: filter session count sums by created_at (#6529)
Fixes the session totals being waaaaay too high!
1 parent 1cc10f2 commit 70b093f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

coderd/database/queries.sql.go

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

coderd/database/queries/workspaceagentstats.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ WITH agent_stats AS (
7070
coalesce(SUM(session_count_reconnecting_pty), 0)::bigint AS session_count_reconnecting_pty
7171
FROM (
7272
SELECT *, ROW_NUMBER() OVER(PARTITION BY agent_id ORDER BY created_at DESC) AS rn
73-
FROM workspace_agent_stats
73+
FROM workspace_agent_stats WHERE created_at > $1
7474
) AS a WHERE a.rn = 1
7575
)
7676
SELECT * FROM agent_stats, latest_agent_stats;

0 commit comments

Comments
 (0)