mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-03-18 21:30:44 +01:00
Log
This commit is contained in:
7
db/db.go
7
db/db.go
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user