Skip to content

Commit

Permalink
Bump default timeout to 2m (#509)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
brian-brazil authored Aug 16, 2019
1 parent 117b3d6 commit 4bf1892
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4bf1892

Please sign in to comment.