-
Notifications
You must be signed in to change notification settings - Fork 943
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
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ee6577d
WIP
mtojek 7d61519
has-agent:connecting, connected
mtojek b5a1ecc
Fix
mtojek dca2b8b
Fix
mtojek 0a4746c
has-agent:disconnected, timeout
mtojek 70952e1
Fix: typo
mtojek 7965a54
Fix
mtojek c1bd839
TODOs
mtojek 2af4133
databasefake
mtojek f9e2167
Fix: typo
mtojek 45957c1
More TODOs
mtojek 66892d7
databasefake
mtojek fc93f90
Timeout tests
mtojek e587b5d
Address PR comments
mtojek 458a8eb
Implement FIXMEs
mtojek 81d9fef
Renamings
mtojek 5ca8c17
Address PR comments
mtojek ec2d571
Fix: readability
mtojek 4b2f831
Fix: refactor CASE logic
mtojek 3c0d4fe
CASE logic
mtojek 9067a9e
Fix
mtojek c14663c
Use CTE
mtojek 9c2f64a
Polishing
mtojek 44bf343
Comment
mtojek 598b140
WIP
mtojek f3787d1
Merge branch 'main' into 4679-surface-agent
mtojek ba13e03
IS NOT NULL
mtojek d74b072
Without CTE
mtojek 4255448
One more optimization
mtojek 4ace659
2nd optimization
mtojek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use CTE
- Loading branch information
commit c14663c0c7dab22d94f0b03788ec42fc617d017e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you also CTE'd the
latest_build
query, like this:You could join
latest_builds
inworkspace_builds_agents
to reduce the agent results to the latest build only. This should make the query more performant (reduced rows).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good suggestion, but won't it be a problem that
latest_build
goes over all workspaces?I presume that we will need
latest_builds
(plural) for every workspace, but I'm not sure if it isn't the same complexity.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I investigated a few concepts we talked about offline with @mafredri:
latest_build
withworkspace_latest_builds
CTE.Unfortunately, I wasn't able to select only the last build per workspace.
workspace_build_agent
CTE withJOIN LATERAL
.Workspaces with multiple agents will return multiple records, which is unexpected.
It looks like the conditional logic will fire only if
has-agent
is specified and it shouldn't affect otherGetWorkspaces
queries.Let me know your thoughts.