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
Show file tree
Hide file tree
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
Fix: typo
  • Loading branch information
mtojek committed Nov 22, 2022
commit 70952e16cf9625f7cfc5318b2c106a5012ab17c3
18 changes: 9 additions & 9 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions coderd/database/queries/workspaces.sql
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ WHERE
END
-- Filter by agent status
AND CASE
WHEN @has_agent :: text != '' THEN
CASE
WHEN @has_agent :: text != '' THEN
CASE
WHEN @has_agent = 'timeout' THEN
latest_build.first_connected_at IS NULL AND (latest_build.created_at + latest_build.connection_timeout_seconds * interval '1 second' < NOW())
WHEN @has_agent = 'connecting' THEN
latest_build.first_connected_at IS NULL
latest_build.first_connected_at IS NULL AND (latest_build.created_at + latest_build.connection_timeout_seconds * interval '1 second' < NOW())
WHEN @has_agent = 'connecting' THEN
latest_build.first_connected_at IS NULL
WHEN @has_agent = 'disconnected' THEN
latest_build.disconnected_at IS NOT NULL AND
latest_build.disconnected_at > workspace_agents.last_connected_at
latest_build.disconnected_at IS NOT NULL AND
latest_build.disconnected_at > latest_build.last_connected_at
WHEN @has_agent = 'connected' THEN
latest_build.last_connected_at IS NOT NULL
ELSE true
latest_build.last_connected_at IS NOT NULL
ELSE true
END
ELSE true
END
Expand Down