Bump default timeout to 2m (#509)
authorBrian Brazil <brian.brazil@robustperception.io>
Fri, 16 Aug 2019 12:43:30 +0000 (13:43 +0100)
committerGitHub <noreply@github.com>
Fri, 16 Aug 2019 12:43:30 +0000 (13:43 +0100)
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 <brian.brazil@robustperception.io>
main.go
main_test.go

diff --git a/main.go b/main.go
index 58ba88b280402b5dc1b89f4566cfc4cc54503654..509e62ed14b8ed1ffdb1508d806a6e59738f27e8 100644 (file)
--- 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
index ad69ae4a78d94664ac1d3deb9134f5be614ca2da..c2341ec1194452e6aed7e40c7956d05a8ed5fe26 100644 (file)
@@ -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 {