10000 Filter query: has-agent connecting, connected, disconnected, timeout by mtojek · Pull Request #5145 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

Filter query: has-agent connecting, connected, disconnected, timeout #5145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Nov 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
databasefake
  • Loading branch information
mtojek committed Nov 22, 2022
commit 2af41331ccc2264b02ac82bd6fd4a32c35a490c9
7 changes: 5 additions & 2 deletions coderd/database/databasefake/databasefake.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,12 @@ func (q *fakeQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg database.
hasAgentValid = wa.LastConnectedAt.Valid
case "connecting":
hasAgentValid = !wa.FirstConnectedAt.Valid
case "disconnected":
hasAgentValid = wa.DisconnectedAt.Valid && wa.DisconnectedAt.Time.After(wa.LastConnectedAt.Time)
case "timeout":
hasAgentValid = !wa.FirstConnectedAt.Valid &&
wa.CreatedAt.Add(time.Duration(wa.ConnectionTimeoutSeconds)*time.Second).Before(database.Now())
}
// TODO disconnected
// TODO timeout
break // only 1 agent is expected
}

Expand Down
0