Skip to content

feat: implement deadline bumping from workspace app activity #12916

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

Closed
wants to merge 1 commit into from

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Apr 9, 2024

closes #11812

This is very inefficient in it's current state

The current interval at which these stats are flushed is 30s. There could be a large number of workspaces here, and this would essentially go against the work @mafredri did with rollups to reduce db load.

ActivityBumpWorkspace cannot be made to take multiple workspace ids because of this LIMIT 1. Creating temporary tables for the "latest workspace build" has been a pain spot in so many queries.

If we could make ActivityBumpWorkspace take multiple workspace ids, then this could be a decent patch for the time being?

I think the best way to make it take multiple workspace ids is to create a view for latest_builds. Then we can reuse that in all our queries.


This might be the answer??

-- name: GetLatestWorkspaceBuildsByWorkspaceIDs :many
SELECT wb.*
FROM (
SELECT
workspace_id, MAX(build_number) as max_build_number
FROM
workspace_build_with_user AS workspace_builds
WHERE
workspace_id = ANY(@ids :: uuid [ ])
GROUP BY
workspace_id
) m
JOIN
workspace_build_with_user AS wb
ON m.workspace_id = wb.workspace_id AND m.max_build_number = wb.build_number;

@Emyrk
Copy link
Member Author

Emyrk commented Apr 12, 2024

@johnstcn brought up this: https://github.com/coder/coder/blob/main/coderd/agentapi/stats.go#L74

Apps should make connections to the workspace agent, incrementing the ConnectionCount, which bumps the activity async.

@Emyrk Emyrk closed this Apr 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
@github-actions github-actions bot deleted the stevenmasley/workspace_apps_trigger_deadline branch October 10, 2024 00:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coder "app" connections are not recorded as workspace usage for the purposes of detecting idle state
1 participant