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

Commitd1305ac

Browse files
authored
fix: stop logging error when template schedule query is canceled (#15402)
Fixes test flakes _a la_``` t.go:108: 2024-11-05 09:52:37.996 [erro] workspacestats: failed to load template schedule bumping activity, defaulting to bumping by 60min request_id=f14215d2-73dc-47ba-aa81-422c62f257e4 workspace_id=545d73c7-3a62-4466-8c08-b6abb12867b7 template_id=49747428-3abb-40e4-a6b2-03653e9f2506 ... error= fetch object: github.com/coder/coder/v2/coderd/database/dbauthz.(*querier).GetTemplateByID.fetch[...].func1 /home/runner/work/coder/coder/coderd/database/dbauthz/dbauthz.go:497 - pq: canceling statement due to user request *** slogtest: log detected at level ERROR; TEST FAILURE ***```seen here on main:https://github.com/coder/coder/actions/runs/11681605747/job/32527006174
1 parent6117f46 commitd1305ac

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎coderd/workspacestats/reporter.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,21 @@ func (r *Reporter) ReportAgentStats(ctx context.Context, now time.Time, workspac
154154
templateSchedule,err:= (*(r.opts.TemplateScheduleStore.Load())).Get(ctx,r.opts.Database,workspace.TemplateID)
155155
// If the template schedule fails to load, just default to bumping
156156
// without the next transition and log it.
157-
iferr!=nil {
157+
iferr==nil {
158+
next,allowed:=schedule.NextAutostart(now,workspace.AutostartSchedule.String,templateSchedule)
159+
ifallowed {
160+
nextAutostart=next
161+
}
162+
}elseifdatabase.IsQueryCanceledError(err) {
163+
r.opts.Logger.Debug(ctx,"query canceled while loading template schedule",
164+
slog.F("workspace_id",workspace.ID),
165+
slog.F("template_id",workspace.TemplateID))
166+
}else {
158167
r.opts.Logger.Error(ctx,"failed to load template schedule bumping activity, defaulting to bumping by 60min",
159168
slog.F("workspace_id",workspace.ID),
160169
slog.F("template_id",workspace.TemplateID),
161170
slog.Error(err),
162171
)
163-
}else {
164-
next,allowed:=schedule.NextAutostart(now,workspace.AutostartSchedule.String,templateSchedule)
165-
ifallowed {
166-
nextAutostart=next
167-
}
168172
}
169173
}
170174

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp