mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-22 20:26:44 +00:00
fix(daemon): silence benign NATS unsubscribe noise on shutdown (#523)
Skip ERROR log when a subscription is already invalid (nats.ErrBadSubscription) during graceful shutdown; log at debug instead. Cosmetic cleanup race, no functional impact.
This commit is contained in:
@@ -2192,7 +2192,11 @@ func (d *Daemon) setupShutdown() {
|
||||
for _, sub := range d.natsSubscriptions {
|
||||
slog.Info("Unsubscribing from NATS", "subject", sub.Subject)
|
||||
if err := sub.Unsubscribe(); err != nil {
|
||||
slog.Error("Error unsubscribing from NATS", "err", err)
|
||||
if errors.Is(err, nats.ErrBadSubscription) {
|
||||
slog.Debug("NATS subscription already invalid during shutdown", "subject", sub.Subject)
|
||||
} else {
|
||||
slog.Error("Error unsubscribing from NATS", "err", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user