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

Skip to content

Commit 8940ea1

Browse files
authored
fix: Always set DisconnectedAt if the agent isn't connected (coder#4328)
Fixes coder#4315.
1 parent 5870176 commit 8940ea1

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
@@ -579,6 +579,8 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator *tailnet.Coordi
579579
case database.Now().Sub(dbAgent.LastConnectedAt.Time) > agentInactiveDisconnectTimeout:
580580
// The connection died without updating the last connected.
581581
workspaceAgent.Status = codersdk.WorkspaceAgentDisconnected
582+
// Client code needs an accurate disconnected at if the agent has been inactive.
583+
workspaceAgent.DisconnectedAt = &dbAgent.LastConnectedAt.Time
582584
case dbAgent.LastConnectedAt.Valid:
583585
// The agent should be assumed connected if it's under inactivity timeouts
584586
// and last connected at has been properly set.

0 commit comments

Comments
 (0)