Skip to content

Commit 8e41ada

Browse files
committed
fix: check if context is nil when logging coordination delete errors
I'm not exactly sure how to handle this idiomatically... See: https://github.com/coder/coder/actions/runs/8976564938/job/24653672411
1 parent b56c9c4 commit 8e41ada

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

enterprise/tailnet/pgcoord.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,11 @@ func (h *heartbeats) sendDelete() {
16541654
ctx := dbauthz.As(context.Background(), pgCoordSubject)
16551655
err := h.store.DeleteCoordinator(ctx, h.self)
16561656
if err != nil {
1657-
h.logger.Error(h.ctx, "failed to send coordinator delete", slog.Error(err))
1657+
// If this errors and the context is no longer active, this
1658+
// most likely is a database connection error.
1659+
if h.ctx.Err() == nil {
1660+
h.logger.Error(h.ctx, "failed to send coordinator delete", slog.Error(err))
1661+
}
16581662
return
16591663
}
16601664
h.logger.Debug(h.ctx, "deleted coordinator")

0 commit comments

Comments
 (0)