mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: stop updating agent stats from deleted workspaces (#11026)
Co-authored-by: Steven Masley <stevenmasley@gmail.com>
This commit is contained in:
co-authored by
Steven Masley
parent
1e349f0d50
commit
228cbec99b
@@ -3762,6 +3762,9 @@ func (q *FakeQuerier) GetWorkspaceAgentAndOwnerByAuthToken(_ context.Context, au
|
||||
if build.WorkspaceID != ws.ID {
|
||||
continue
|
||||
}
|
||||
if ws.Deleted {
|
||||
continue
|
||||
}
|
||||
var row database.GetWorkspaceAgentAndOwnerByAuthTokenRow
|
||||
row.WorkspaceID = ws.ID
|
||||
usr, err := q.getUserByIDNoLock(ws.OwnerID)
|
||||
|
||||
@@ -7754,9 +7754,10 @@ FROM users
|
||||
WHERE
|
||||
-- TODO: we can add more conditions here, such as:
|
||||
-- 1) The user must be active
|
||||
-- 2) The user must not be deleted
|
||||
-- 3) The workspace must be running
|
||||
-- 2) The workspace must be running
|
||||
workspace_agents.auth_token = $1
|
||||
AND
|
||||
workspaces.deleted = FALSE
|
||||
GROUP BY
|
||||
workspace_agents.id,
|
||||
workspaces.id,
|
||||
|
||||
@@ -252,9 +252,10 @@ FROM users
|
||||
WHERE
|
||||
-- TODO: we can add more conditions here, such as:
|
||||
-- 1) The user must be active
|
||||
-- 2) The user must not be deleted
|
||||
-- 3) The workspace must be running
|
||||
-- 2) The workspace must be running
|
||||
workspace_agents.auth_token = @auth_token
|
||||
AND
|
||||
workspaces.deleted = FALSE
|
||||
GROUP BY
|
||||
workspace_agents.id,
|
||||
workspaces.id,
|
||||
|
||||
Reference in New Issue
Block a user