Skip to content

Commit a3651ba

Browse files
committed
fix: compare builds instead of statuses
when updating the workspace and agent. Checking the status is subtly different from checking if there is a new build in the following scenario: 1. Latest build is failed. 2. The poll runs, so we currently have failed stored as the status. 3. User starts workspace, we set to queued. 4. Build fails again (a brand-new build, but it is also failing). 5. Poll runs again, checks failed against the last status, which is also failed, so it leaves the status as queued, even though the workspace is actually failed currently, so really we do want to update the state to failed. So we could miss updates from one build to another build when both builds end up with the same status.
1 parent fa8f6ac commit a3651ba

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,7 @@ class CoderRemoteEnvironment(
260260
* Update the workspace/agent status to the listeners, if it has changed.
261261
*/
262262
fun update(workspace: Workspace, agent: WorkspaceAgent) {
263-
if (WorkspaceAndAgentStatus.from(this.workspace, this.agent) == WorkspaceAndAgentStatus.from(
264-
workspace,
265-
agent
266-
)
267-
) {
263+
if (this.workspace.latestBuild == workspace.latestBuild) {
268264
return
269265
}
270266
this.workspace = workspace

0 commit comments

Comments
 (0)