From 2de6a9967bd978494d1565b5b8318ac8832057ad Mon Sep 17 00:00:00 2001 From: Oliver Eilhard Date: Wed, 27 Jul 2016 18:42:36 +0200 Subject: [PATCH] Fix sniffer to use correct interval The sniffing process, run by `sniffer` periodically, looks for nodes added or removed from the cluster. However, it was run at the wrong interval. We used the sniffing timeout instead of the sniffing interval by mistake. Update your clients if you see lots of calls to `_nodes/http` in your log file. See #332 --- CONTRIBUTORS | 1 + client.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index dff2a14d7..7f17307d8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -30,6 +30,7 @@ Harrison Wright [@wright8191](https://github.com/wright8191) Igor Dubinskiy [@idubinskiy](https://github.com/idubinskiy) Isaac Saldana [@isaldana](https://github.com/isaldana) Jack Lindamood [@cep21](https://github.com/cep21) +Jayme Rotsaert [@jrots](https://github.com/jrots) Joe Buck [@four2five](https://github.com/four2five) John Barker [@j16r](https://github.com/j16r) John Goodall [@jgoodall](https://github.com/jgoodall) diff --git a/client.go b/client.go index fe0fa2254..63cdca667 100644 --- a/client.go +++ b/client.go @@ -21,7 +21,7 @@ import ( const ( // Version is the current version of Elastic. - Version = "3.0.43" + Version = "3.0.44" // DefaultUrl is the default endpoint of Elasticsearch on the local machine. // It is used e.g. when initializing a new Client without a specific URL. @@ -681,9 +681,10 @@ func (c *Client) dumpResponse(resp *http.Response) { func (c *Client) sniffer() { c.mu.RLock() timeout := c.snifferTimeout + interval := c.snifferInterval c.mu.RUnlock() - ticker := time.NewTicker(timeout) + ticker := time.NewTicker(interval) defer ticker.Stop() for {