Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f34592f

Browse files
authored
fix(coderd): skip logging error for cancelled query in agent report stats (#12730)
1 parent 951dfaa commit f34592f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

coderd/workspaceagents.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,13 @@ func (api *API) workspaceAgentReportStats(rw http.ResponseWriter, r *http.Reques
11711171
templateSchedule, err := (*(api.TemplateScheduleStore.Load())).Get(ctx, api.Database, workspace.TemplateID)
11721172
// If the template schedule fails to load, just default to bumping without the next transition and log it.
11731173
if err != nil {
1174+
// There's nothing we can do if the query was canceled, the
1175+
// client most likely went away so we just return an internal
1176+
// server error.
1177+
if database.IsQueryCanceledError(err) {
1178+
httpapi.InternalServerError(rw, err)
1179+
return
1180+
}
11741181
api.Logger.Error(ctx, "failed to load template schedule bumping activity, defaulting to bumping by 60min",
11751182
slog.F("workspace_id", workspace.ID),
11761183
slog.F("template_id", workspace.TemplateID),

0 commit comments

Comments
 (0)