diff --git a/internal/gounicorn/gounicorn.go b/internal/gounicorn/gounicorn.go index f41f219b3..a63cc43ac 100644 --- a/internal/gounicorn/gounicorn.go +++ b/internal/gounicorn/gounicorn.go @@ -83,14 +83,20 @@ func (g *GoUnicorn) healthcheck() { // Default healthcheck is every 1 second on startup // once we've been healthy once, increase to 30 seconds - for range time.Tick(time.Second) { - if check() { - g.log.Info("backend is alive, backing off with healthchecks") - g.HealthyCallback() - break + func() { + for { + select { + case <-time.Tick(1 * time.Second): + if check() { + g.log.Info("backend is alive, backing off with healthchecks") + g.HealthyCallback() + return + } else { + g.log.Debug("backend not alive yet") + } + } } - g.log.Debug("backend not alive yet") - } + }() for range time.Tick(30 * time.Second) { check() }