From 161a3cfa26a9403bc8bc00cd3179d45b782b2038 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 19 Sep 2023 18:16:07 +0300 Subject: [PATCH] fix(coderd/batchstats): use debug log on query cancellation in flush (#9778) Fixes #9772 --- coderd/batchstats/batcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coderd/batchstats/batcher.go b/coderd/batchstats/batcher.go index d0b3e4fb6c..cc234c693e 100644 --- a/coderd/batchstats/batcher.go +++ b/coderd/batchstats/batcher.go @@ -243,8 +243,8 @@ func (b *Batcher) flush(ctx context.Context, forced bool, reason string) { err = b.store.InsertWorkspaceAgentStats(ctx, *b.buf) elapsed := time.Since(start) if err != nil { - if xerrors.Is(err, context.Canceled) { - b.log.Debug(ctx, "context canceled, skipping insert of workspace agent stats", slog.F("elapsed", elapsed)) + if database.IsQueryCanceledError(err) { + b.log.Debug(ctx, "query canceled, skipping insert of workspace agent stats", slog.F("elapsed", elapsed)) return } b.log.Error(ctx, "error inserting workspace agent stats", slog.Error(err), slog.F("elapsed", elapsed))