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

Function isAgentUnreachable

coderd/x/chatd/chatd.go:978–982  ·  view source on GitHub ↗

isAgentUnreachable reports whether the given agent row's status is disconnected or timed out. It uses timestamp arithmetic on the row. The "connecting" state is allowed through because it is normal after a fresh workspace build.

(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration)

Source from the content-addressed store, hash-verified

976// arithmetic on the row. The "connecting" state is allowed
977// through because it is normal after a fresh workspace build.
978func isAgentUnreachable(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration) bool {
979 status := agent.Status(now, inactiveTimeout)
980 return status.Status == database.WorkspaceAgentStatusDisconnected ||
981 status.Status == database.WorkspaceAgentStatusTimeout
982}
983
984func agentDisconnectedFor(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration) (time.Duration, bool) {
985 status := agent.Status(now, inactiveTimeout)

Callers 1

Calls 1

StatusMethod · 0.45

Tested by

no test coverage detected