mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: prevent activity bump for prebuilt workspaces (#19263)
## Description
This PR ensures that activity-based deadline extensions ("activity
bumping") are not applied to prebuilt workspaces. Prebuilds are managed
by the reconciliation loop and must not have `deadline` or
`max_deadline` values set or extended, as they are not part of the
regular lifecycle executor path.
## Changes
- Update `ActivityBumpWorkspace` SQL query to discard prebuilt
workspaces
- Update application layer to avoid calling activity bump logic on
prebuilt workspaces
Related with:
* Issue: https://github.com/coder/coder/issues/18898
* PR: https://github.com/coder/coder/pull/19252
This commit is contained in:
@@ -32,7 +32,7 @@ WITH latest AS (
|
||||
-- be as if the workspace auto started at the given time and the
|
||||
-- original TTL was applied.
|
||||
--
|
||||
-- Sadly we can't define ` + "`" + `activity_bump_interval` + "`" + ` above since
|
||||
-- Sadly we can't define 'activity_bump_interval' above since
|
||||
-- it won't be available for this CASE statement, so we have to
|
||||
-- copy the cast twice.
|
||||
WHEN NOW() + (templates.activity_bump / 1000 / 1000 / 1000 || ' seconds')::interval > $1 :: timestamptz
|
||||
@@ -62,7 +62,11 @@ WITH latest AS (
|
||||
ON workspaces.id = workspace_builds.workspace_id
|
||||
JOIN templates
|
||||
ON templates.id = workspaces.template_id
|
||||
WHERE workspace_builds.workspace_id = $2::uuid
|
||||
WHERE
|
||||
workspace_builds.workspace_id = $2::uuid
|
||||
-- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
|
||||
-- are managed by the reconciliation loop and not subject to activity bumping
|
||||
AND workspaces.owner_id != 'c42fdf75-3097-471c-8c33-fb52454d81c0'::UUID
|
||||
ORDER BY workspace_builds.build_number DESC
|
||||
LIMIT 1
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user