From 4bf18924d4645453ec3e240d01842b7f15db537c Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Fri, 16 Aug 2019 13:43:30 +0100 Subject: [PATCH] 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 --- main.go | 2 +- main_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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 { -- 2.25.1