From 85d728ff4f8aa2bff1f0f15ee7beb5e9bcef2f4c Mon Sep 17 00:00:00 2001 From: Peter Klijn Date: Wed, 29 Jul 2020 15:22:34 +0200 Subject: [PATCH] Changed use of timeout, instead of setting it on the httpclient, set it in the consul client (#56) --- monitor/consul/watcher.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/monitor/consul/watcher.go b/monitor/consul/watcher.go index a6045ae8..123c22a3 100644 --- a/monitor/consul/watcher.go +++ b/monitor/consul/watcher.go @@ -46,17 +46,11 @@ func New(addr, dc, token string, timeout time.Duration, ii ...Item) (*Watcher, e if len(ii) == 0 { return nil, errors.New("items are empty") } - if timeout == 0 { - timeout = 60 * time.Second - } cfg := api.DefaultConfig() cfg.Address = addr - var err error - cfg.HttpClient, err = api.NewHttpClient(cfg.Transport, cfg.TLSConfig) - if err != nil { - return nil, err + if timeout > 0 { + cfg.WaitTime = timeout } - cfg.HttpClient.Timeout = timeout cl, err := api.NewClient(cfg) if err != nil {