Skip to content

Commit

Permalink
health: show deprecation warning only once
Browse files Browse the repository at this point in the history
Otherwise, if loading a thousand apis that use it, one would get the
same warning a thousand times, which isn't particularly useful.
  • Loading branch information
mvdan authored and buger committed Sep 6, 2017
1 parent ee02446 commit 5b8156b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api_healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"strconv"
"strings"
"sync"
"time"
)

Expand Down Expand Up @@ -35,10 +36,14 @@ type DefaultHealthChecker struct {
APIID string
}

var healthWarn sync.Once

func (h *DefaultHealthChecker) Init(storeType StorageHandler) {
if globalConf.HealthCheck.EnableHealthChecks {
log.Debug("Health Checker initialised.")
log.Warning("The Health Checker is deprecated and we do no longer recommend its use.")
healthWarn.Do(func() {
log.Warning("The Health Checker is deprecated and we do no longer recommend its use.")
})
}

h.storage = storeType
Expand Down

0 comments on commit 5b8156b

Please sign in to comment.