mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: return only the first workspace agent script timing per script (#16203)
Fixes https://github.com/coder/coder/issues/16124 If a workspace agent crashes, it is possible for any startup scripts to be ran again. This PR makes it so that the `GetWorkspaceAgentScriptTimingsByBuildID` query only returns the first timing recorded per-script.
This commit is contained in:
@@ -304,7 +304,7 @@ RETURNING workspace_agent_script_timings.*;
|
||||
|
||||
-- name: GetWorkspaceAgentScriptTimingsByBuildID :many
|
||||
SELECT
|
||||
workspace_agent_script_timings.*,
|
||||
DISTINCT ON (workspace_agent_script_timings.script_id) workspace_agent_script_timings.*,
|
||||
workspace_agent_scripts.display_name,
|
||||
workspace_agents.id as workspace_agent_id,
|
||||
workspace_agents.name as workspace_agent_name
|
||||
@@ -313,4 +313,5 @@ INNER JOIN workspace_agent_scripts ON workspace_agent_scripts.id = workspace_age
|
||||
INNER JOIN workspace_agents ON workspace_agents.id = workspace_agent_scripts.workspace_agent_id
|
||||
INNER JOIN workspace_resources ON workspace_resources.id = workspace_agents.resource_id
|
||||
INNER JOIN workspace_builds ON workspace_builds.job_id = workspace_resources.job_id
|
||||
WHERE workspace_builds.id = $1;
|
||||
WHERE workspace_builds.id = $1
|
||||
ORDER BY workspace_agent_script_timings.script_id, workspace_agent_script_timings.started_at;
|
||||
|
||||
Reference in New Issue
Block a user