Skip to content

Commit d6089ae

Browse files
authored
fix(coderd/batchstats): use debug log on context cancellation in flush (#9777)
1 parent 7bc98c2 commit d6089ae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

coderd/batchstats/batcher.go

+4
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ func (b *Batcher) flush(ctx context.Context, forced bool, reason string) {
243243
err = b.store.InsertWorkspaceAgentStats(ctx, *b.buf)
244244
elapsed := time.Since(start)
245245
if err != nil {
246+
if xerrors.Is(err, context.Canceled) {
247+
b.log.Debug(ctx, "context canceled, skipping insert of workspace agent stats", slog.F("elapsed", elapsed))
248+
return
249+
}
246250
b.log.Error(ctx, "error inserting workspace agent stats", slog.Error(err), slog.F("elapsed", elapsed))
247251
return
248252
}

0 commit comments

Comments
 (0)