From a5a918060595a61c1b3f2983a097d14fca53d000 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 25 Jul 2017 04:54:22 +0100 Subject: [PATCH] do not back off on timeouts when sending reports ...since doing so unnecessarily throttles report sending, to the point where the app is receiving reports so infrequently that often it has no data to show. The timeout period itself is sufficient to prevent thrashing. Fixes #2745. --- probe/appclient/app_client.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/probe/appclient/app_client.go b/probe/appclient/app_client.go index ac3fee515..4c19cbfb5 100644 --- a/probe/appclient/app_client.go +++ b/probe/appclient/app_client.go @@ -4,6 +4,7 @@ import ( "fmt" "io" "io/ioutil" + "net" "net/http" "net/rpc" "net/url" @@ -215,7 +216,16 @@ func (c *appClient) doWithBackoff(msg string, f func() (bool, error)) { backoff = initialBackoff continue } - + if netErr, ok := err.(net.Error); ok && netErr.Timeout() { + // The timeout period itself serves as a backoff that + // prevents thrashing. Hence there is no need to introduce + // further delays. Moreover, any delays between publishing + // reports that exceed the app.window (defaults to 15s) + // cause the UI to display no data, which is debilitating. + log.Errorf("Error doing %s for %s: %v", msg, c.hostname, err) + backoff = initialBackoff + continue + } log.Errorf("Error doing %s for %s, backing off %s: %v", msg, c.hostname, backoff, err) select { case <-time.After(backoff):