Skip to content

Commit cf4a423

Browse files
committed
fixup! fix: prevent error log when pgcoord query is canceled.
1 parent 97ac7b9 commit cf4a423

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

enterprise/tailnet/pgcoord.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func (b *binder) writeOne(bnd binding) error {
424424
default:
425425
panic("unhittable")
426426
}
427-
if err != nil && !pqErrIsCanceled(err) {
427+
if err != nil && !database.IsQueryCanceledError(err) {
428428
b.logger.Error(b.ctx, "failed to write binding to database",
429429
slog.F("client_id", bnd.client),
430430
slog.F("agent_id", bnd.agent),
@@ -434,12 +434,6 @@ func (b *binder) writeOne(bnd binding) error {
434434
return err
435435
}
436436

437-
// This is returned when the context is canceled on a running query. pq does not
438-
// export an error for this.
439-
func pqErrIsCanceled(err error) bool {
440-
return err.Error() == "pq: canceling statement due to user request"
441-
}
442-
443437
// storeBinding stores the latest binding, where we interpret node == nil as removing the binding. This keeps the map
444438
// from growing without bound.
445439
func (b *binder) storeBinding(bnd binding) {

0 commit comments

Comments
 (0)