From 7e2c6e51887bcf51fa0565ceba07771ec7e85754 Mon Sep 17 00:00:00 2001 From: yaling888 <73897884+yaling888@users.noreply.github.com> Date: Mon, 28 Mar 2022 00:46:44 +0800 Subject: [PATCH] Chore: adjust HealthCheck at first check --- adapter/provider/healthcheck.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/adapter/provider/healthcheck.go b/adapter/provider/healthcheck.go index 7a89ffa3..bfbaf6b0 100644 --- a/adapter/provider/healthcheck.go +++ b/adapter/provider/healthcheck.go @@ -31,7 +31,13 @@ type HealthCheck struct { func (hc *HealthCheck) process() { ticker := time.NewTicker(time.Duration(hc.interval) * time.Second) - go hc.check() + go func() { + t := time.NewTicker(30 * time.Second) + <-t.C + t.Stop() + hc.check() + }() + for { select { case <-ticker.C: