Skip to content

Commit 61713a0

Browse files
committed
fix: Always set DisconnectedAt if the agent isn't connected
Fixes #4315.
1 parent bbebc1a commit 61713a0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

coderd/workspaceagents.go

+2
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator *tailnet.Coordi
574574
case database.Now().Sub(dbAgent.LastConnectedAt.Time) > agentInactiveDisconnectTimeout:
575575
// The connection died without updating the last connected.
576576
workspaceAgent.Status = codersdk.WorkspaceAgentDisconnected
577+
// Client code needs an accurate disconnected at if the agent has been inactive.
578+
workspaceAgent.DisconnectedAt = &dbAgent.LastConnectedAt.Time
577579
case dbAgent.LastConnectedAt.Valid:
578580
// The agent should be assumed connected if it's under inactivity timeouts
579581
// and last connected at has been properly set.

0 commit comments

Comments
 (0)