This commit is contained in:
binwiederhier
2026-03-11 22:09:00 -04:00
parent 1f483dcbd3
commit 9eaadd74cf

View File

@@ -10,6 +10,7 @@ import (
) )
const ( const (
tag = "db"
replicaHealthCheckInitialDelay = 5 * time.Second replicaHealthCheckInitialDelay = 5 * time.Second
replicaHealthCheckInterval = 30 * time.Second replicaHealthCheckInterval = 30 * time.Second
replicaHealthCheckTimeout = 10 * time.Second replicaHealthCheckTimeout = 10 * time.Second
@@ -138,13 +139,11 @@ func (d *DB) checkReplicas(ctx context.Context) {
cancel() cancel()
if err != nil { if err != nil {
r.healthy.Store(false) r.healthy.Store(false)
if wasHealthy { log.Tag(tag).Error("Database replica %s is unhealthy: %s", r.Addr, err)
log.Error("Database replica %s is unhealthy: %s", r.Addr, err)
}
} else { } else {
r.healthy.Store(true) r.healthy.Store(true)
if !wasHealthy { if !wasHealthy {
log.Info("Database replica %s is healthy", r.Addr) log.Tag(tag).Info("Database replica %s is healthy", r.Addr)
} }
} }
} }