mirror of https://github.com/coder/coder.git
fix: Always set `DisconnectedAt` if the agent isn't connected (#4328)
Fixes #4315.
This commit is contained in:
parent
587017665a
commit
8940ea179e
|
@ -579,6 +579,8 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator *tailnet.Coordi
|
|||
case database.Now().Sub(dbAgent.LastConnectedAt.Time) > agentInactiveDisconnectTimeout:
|
||||
// The connection died without updating the last connected.
|
||||
workspaceAgent.Status = codersdk.WorkspaceAgentDisconnected
|
||||
// Client code needs an accurate disconnected at if the agent has been inactive.
|
||||
workspaceAgent.DisconnectedAt = &dbAgent.LastConnectedAt.Time
|
||||
case dbAgent.LastConnectedAt.Valid:
|
||||
// The agent should be assumed connected if it's under inactivity timeouts
|
||||
// and last connected at has been properly set.
|
||||
|
|
Loading…
Reference in New Issue