(now time.Time, agent database.WorkspaceAgent, inactiveTimeout time.Duration)
| 982 | } |
| 983 | |
| 984 | func 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 | |
| 997 | func (c *turnWorkspaceContext) latestWorkspaceAgentNeedsRestart( |
| 998 | ctx context.Context, |
no test coverage detected