From: Brian Brazil Date: Fri, 16 Aug 2019 12:43:30 +0000 (+0100) Subject: Bump default timeout to 2m (#509) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4bf18924d4645453ec3e240d01842b7f15db537c;p=blackbox_exporter.git Bump default timeout to 2m (#509) The current default of 10s is problematic when testing slower probes from a browser. Cancellation will still work as a fallback, including for older Prometheus servers that don't send the timeout header, so there shouldn't be a big buildup of ongoing probes. Fixes #259 Signed-off-by: Brian Brazil --- diff --git a/main.go b/main.go index 58ba88b..509e62e 100644 --- a/main.go +++ b/main.go @@ -354,7 +354,7 @@ func getTimeout(r *http.Request, module config.Module, offset float64) (timeoutS } } if timeoutSeconds == 0 { - timeoutSeconds = 10 + timeoutSeconds = 120 } var maxTimeoutSeconds = timeoutSeconds - offset diff --git a/main_test.go b/main_test.go index ad69ae4..c2341ec 100644 --- a/main_test.go +++ b/main_test.go @@ -116,12 +116,12 @@ func TestTimeoutIsSetCorrectly(t *testing.T) { {20 * time.Second, "15", 0, 15}, {5 * time.Second, "15", 0, 5}, {5 * time.Second, "15", 0.5, 5}, - {10 * time.Second, "", 0.5, 9.5}, + {10 * time.Second, "", 0.5, 10}, {10 * time.Second, "10", 0.5, 9.5}, {9500 * time.Millisecond, "", 0.5, 9.5}, - {9500 * time.Millisecond, "", 1, 9}, - {0 * time.Second, "", 0.5, 9.5}, - {0 * time.Second, "", 0, 10}, + {9500 * time.Millisecond, "", 1, 9.5}, + {0 * time.Second, "", 0.5, 119.5}, + {0 * time.Second, "", 0, 120}, } for _, v := range tests {