Skip to content

Commit 2761b7e

Browse files
committed
refactor: remove template lifecycle update changes
1 parent 04a481d commit 2761b7e

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

coderd/database/queries.sql.go

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,7 @@ UPDATE
567567
SET
568568
ttl = $2
569569
WHERE
570-
template_id = $1
571-
-- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
572-
-- should not have their TTL updated, as they are handled by the prebuilds
573-
-- reconciliation loop.
574-
AND workspaces.owner_id != 'c42fdf75-3097-471c-8c33-fb52454d81c0'::UUID;
570+
template_id = $1;
575571

576572
-- name: UpdateWorkspaceLastUsedAt :exec
577573
UPDATE
@@ -821,11 +817,8 @@ SET
821817
dormant_at = CASE WHEN @dormant_at::timestamptz > '0001-01-01 00:00:00+00'::timestamptz THEN @dormant_at::timestamptz ELSE dormant_at END
822818
WHERE
823819
template_id = @template_id
824-
AND dormant_at IS NOT NULL
825-
-- Prebuilt workspaces (identified by having the prebuilds system user as owner_id)
826-
-- should not have their dormant or deleting at set, as these are handled by the
827-
-- prebuilds reconciliation loop.
828-
AND workspaces.owner_id != 'c42fdf75-3097-471c-8c33-fb52454d81c0'::UUID
820+
AND
821+
dormant_at IS NOT NULL
829822
RETURNING *;
830823

831824
-- name: UpdateTemplateWorkspacesLastUsedAt :exec

enterprise/coderd/schedule/template.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ func (s *EnterpriseTemplateScheduleStore) Set(ctx context.Context, db database.S
242242
nextStartAts := []time.Time{}
243243

244244
for _, workspace := range workspaces {
245-
// Skip prebuilt workspaces
246-
if workspace.IsPrebuild() {
247-
continue
248-
}
249245
nextStartAt := time.Time{}
250246
if workspace.AutostartSchedule.Valid {
251247
next, err := agpl.NextAllowedAutostart(s.now(), workspace.AutostartSchedule.String, templateSchedule)
@@ -258,7 +254,7 @@ func (s *EnterpriseTemplateScheduleStore) Set(ctx context.Context, db database.S
258254
nextStartAts = append(nextStartAts, nextStartAt)
259255
}
260256

261-
//nolint:gocritic // We need to be able to update information about regular workspaces.
257+
//nolint:gocritic // We need to be able to update information about all workspaces.
262258
if err := db.BatchUpdateWorkspaceNextStartAt(dbauthz.AsSystemRestricted(ctx), database.BatchUpdateWorkspaceNextStartAtParams{
263259
IDs: workspaceIDs,
264260
NextStartAts: nextStartAts,
@@ -338,11 +334,6 @@ func (s *EnterpriseTemplateScheduleStore) updateWorkspaceBuild(ctx context.Conte
338334
return xerrors.Errorf("get workspace %q: %w", build.WorkspaceID, err)
339335
}
340336

341-
// Skip lifecycle updates for prebuilt workspaces
342-
if workspace.IsPrebuild() {
343-
return nil
344-
}
345-
346337
job, err := db.GetProvisionerJobByID(ctx, build.JobID)
347338
if err != nil {
348339
return xerrors.Errorf("get provisioner job %q: %w", build.JobID, err)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy