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)
| 976 | // arithmetic on the row. The "connecting" state is allowed |
| 977 | // through because it is normal after a fresh workspace build. |
| 978 | func 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 | |
| 984 | func agentDisconnectedFor(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration) (time.Duration, bool) { |
| 985 | status := agent.Status(now, inactiveTimeout) |
no test coverage detected