Skip to content

Commit

Permalink
Use a default timeout of 3s when querying etcd health (sensu#3657)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Plourde <[email protected]>
  • Loading branch information
Simon Plourde authored Mar 31, 2020
1 parent 3965c71 commit d789183
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/apid/routers/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/gorilla/mux"
)

const defaultTimeout = 3

// ClusterController represents the controller needs of the ClusterRouter.
type ClusterController interface {
// MemberList lists the current cluster membership.
Expand Down Expand Up @@ -73,7 +75,7 @@ func parsePeerAddrs(req *http.Request) ([]string, error) {
func parseTimeout(req *http.Request) (int, error) {
val := req.FormValue("timeout")
if len(val) == 0 {
return 0, nil
return defaultTimeout, nil
}
return strconv.Atoi(val)
}
Expand Down

0 comments on commit d789183

Please sign in to comment.