Skip to content

Commit

Permalink
Fix sniffer to use correct interval
Browse files Browse the repository at this point in the history
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
  • Loading branch information
olivere committed Jul 27, 2016
1 parent f7ae701 commit 2de6a99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 2de6a99

Please sign in to comment.