Skip to content

Commit 85d24ab

Browse files
committed
refactor: remove activity bump changes
1 parent e322671 commit 85d24ab

File tree

4 files changed

+24
-33
lines changed

4 files changed

+24
-33
lines changed

coderd/database/querier.go

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

coderd/database/queries.sql.go

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

coderd/database/queries/activitybump.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
--
66
-- Max deadline is respected, and the deadline will never be bumped past it.
77
-- The deadline will never decrease.
8-
-- NOTE: This query should only be called for regular user workspaces.
9-
-- Prebuilds are managed by the reconciliation loop and not subject to activity bumping.
108
-- name: ActivityBumpWorkspace :exec
119
WITH latest AS (
1210
SELECT

coderd/workspacestats/reporter.go

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -149,37 +149,34 @@ func (r *Reporter) ReportAgentStats(ctx context.Context, now time.Time, workspac
149149
return nil
150150
}
151151

152-
// Prebuilds are not subject to activity-based deadline bumps
153-
if !workspace.IsPrebuild() {
154-
// check next autostart
155-
var nextAutostart time.Time
156-
if workspace.AutostartSchedule.String != "" {
157-
templateSchedule, err := (*(r.opts.TemplateScheduleStore.Load())).Get(ctx, r.opts.Database, workspace.TemplateID)
158-
// If the template schedule fails to load, just default to bumping
159-
// without the next transition and log it.
160-
switch {
161-
case err == nil:
162-
next, allowed := schedule.NextAutostart(now, workspace.AutostartSchedule.String, templateSchedule)
163-
if allowed {
164-
nextAutostart = next
165-
}
166-
case database.IsQueryCanceledError(err):
167-
r.opts.Logger.Debug(ctx, "query canceled while loading template schedule",
168-
slog.F("workspace_id", workspace.ID),
169-
slog.F("template_id", workspace.TemplateID))
170-
default:
171-
r.opts.Logger.Error(ctx, "failed to load template schedule bumping activity, defaulting to bumping by 60min",
172-
slog.F("workspace_id", workspace.ID),
173-
slog.F("template_id", workspace.TemplateID),
174-
slog.Error(err),
175-
)
152+
// check next autostart
153+
var nextAutostart time.Time
154+
if workspace.AutostartSchedule.String != "" {
155+
templateSchedule, err := (*(r.opts.TemplateScheduleStore.Load())).Get(ctx, r.opts.Database, workspace.TemplateID)
156+
// If the template schedule fails to load, just default to bumping
157+
// without the next transition and log it.
158+
switch {
159+
case err == nil:
160+
next, allowed := schedule.NextAutostart(now, workspace.AutostartSchedule.String, templateSchedule)
161+
if allowed {
162+
nextAutostart = next
176163
}
164+
case database.IsQueryCanceledError(err):
165+
r.opts.Logger.Debug(ctx, "query canceled while loading template schedule",
166+
slog.F("workspace_id", workspace.ID),
167+
slog.F("template_id", workspace.TemplateID))
168+
default:
169+
r.opts.Logger.Error(ctx, "failed to load template schedule bumping activity, defaulting to bumping by 60min",
170+
slog.F("workspace_id", workspace.ID),
171+
slog.F("template_id", workspace.TemplateID),
172+
slog.Error(err),
173+
)
177174
}
178-
179-
// bump workspace activity
180-
ActivityBumpWorkspace(ctx, r.opts.Logger.Named("activity_bump"), r.opts.Database, workspace.ID, nextAutostart)
181175
}
182176

177+
// bump workspace activity
178+
ActivityBumpWorkspace(ctx, r.opts.Logger.Named("activity_bump"), r.opts.Database, workspace.ID, nextAutostart)
179+
183180
// bump workspace last_used_at
184181
r.opts.UsageTracker.Add(workspace.ID)
185182

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