Skip to content

Commit

Permalink
Change HTTP request timeout to 10 secs
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentius15 committed Jul 31, 2018
1 parent 13013ca commit 87df131
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"sort"
"strconv"
"strings"
"time"
)

type promResponse struct {
Expand Down Expand Up @@ -58,7 +59,7 @@ func (p prometheusMetricsDB) callMetricAPI(query string) (*promResponse, error)
q.Add("query", query)
req.URL.RawQuery = q.Encode()
client := &http.Client{
Timeout: 10,
Timeout: 10 * time.Second,
}
resp, err := client.Do(req)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io/ioutil"
"log"
"net/http"
"time"

"github.com/gorilla/mux"
"github.com/jmoiron/sqlx"
Expand Down Expand Up @@ -37,7 +38,7 @@ type agentClient struct{}

func (a agentClient) executeOperationRequest(req *http.Request) (*operation, error) {
client := &http.Client{
Timeout: 10,
Timeout: 10 * time.Second,
}
response, err := client.Do(req)
if err != nil {
Expand Down

0 comments on commit 87df131

Please sign in to comment.