MCPcopy Index your code
hub / github.com/coder/coder / agentDisconnectedFor

Function agentDisconnectedFor

coderd/x/chatd/chatd.go:984–995  ·  view source on GitHub ↗
(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration)

Source from the content-addressed store, hash-verified

982}
983
984func agentDisconnectedFor(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration) (time.Duration, bool) {
985 status := agent.Status(now, inactiveTimeout)
986 if status.Status != database.WorkspaceAgentStatusDisconnected || status.DisconnectedAt == nil {
987 return 0, false
988 }
989
990 disconnectedFor := now.Sub(*status.DisconnectedAt)
991 if disconnectedFor < 0 {
992 disconnectedFor = 0
993 }
994 return disconnectedFor, true
995}
996
997func (c *turnWorkspaceContext) latestWorkspaceAgentNeedsRestart(
998 ctx context.Context,

Callers 2

getWorkspaceConnMethod · 0.85

Calls 1

StatusMethod · 0.45

Tested by

no test coverage detected