Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85d24ab

Browse files
committed
refactor: remove activity bump changes
1 parente322671 commit85d24ab

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 aboutcustomizing 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 aboutcustomizing 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 latestAS (
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
returnnil
150150
}
151151

152-
// Prebuilds are not subject to activity-based deadline bumps
153-
if!workspace.IsPrebuild() {
154-
// check next autostart
155-
varnextAutostart time.Time
156-
ifworkspace.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-
caseerr==nil:
162-
next,allowed:=schedule.NextAutostart(now,workspace.AutostartSchedule.String,templateSchedule)
163-
ifallowed {
164-
nextAutostart=next
165-
}
166-
casedatabase.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+
varnextAutostart time.Time
154+
ifworkspace.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+
caseerr==nil:
160+
next,allowed:=schedule.NextAutostart(now,workspace.AutostartSchedule.String,templateSchedule)
161+
ifallowed {
162+
nextAutostart=next
176163
}
164+
casedatabase.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)

[8]ページ先頭

©2009-2025 Movatter.jp