From c4963f45bdd7e3230434bfc8d2746d4f3488acc9 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Fri, 14 Feb 2020 14:35:35 +0300 Subject: [PATCH] use timer instead of ticker --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index f422b36..1e33ea5 100644 --- a/main.go +++ b/main.go @@ -78,7 +78,8 @@ func main() { } func checkConnection(ctx context.Context, p *Pool) { - tick := time.NewTicker(time.Second * 15) + dur := time.Second * 15 + tick := time.NewTimer(dur) loop: for { @@ -87,6 +88,7 @@ loop: break loop case <-tick.C: p.reBalance(ctx) + tick.Reset(dur) } }