Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
kylecarbs committed May 6, 2024
commit 8e41ada8f4c9bdfcfe0a02dcc8646c4fd776d77b
6 changes: 5 additions & 1 deletion enterprise/tailnet/pgcoord.go
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,11 @@ func (h *heartbeats) sendDelete() {
ctx := dbauthz.As(context.Background(), pgCoordSubject)
err := h.store.DeleteCoordinator(ctx, h.self)
if err != nil {
h.logger.Error(h.ctx, "failed to send coordinator delete", slog.Error(err))
// If this errors and the context is no longer active, this
// most likely is a database connection error.
if h.ctx.Err() == nil {
h.logger.Error(h.ctx, "failed to send coordinator delete", slog.Error(err))
}
return
}
h.logger.Debug(h.ctx, "deleted coordinator")
Expand Down