Set timeout 1 second for GatherStatus().
This commit is contained in:
parent
86fdf05322
commit
34d469319d
@ -3,6 +3,7 @@ package servicestat
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceList map[string]bool
|
type ServiceList map[string]bool
|
||||||
@ -11,7 +12,7 @@ func GatherStatus(url string) (lst ServiceList, err error) {
|
|||||||
rq, _ := http.NewRequest(http.MethodGet, url, nil)
|
rq, _ := http.NewRequest(http.MethodGet, url, nil)
|
||||||
rq.Header.Set("Content-Type", "application/json")
|
rq.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
cl := &http.Client{}
|
cl := &http.Client{Timeout: 1 * time.Second}
|
||||||
r, err := cl.Do(rq)
|
r, err := cl.Do(rq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return lst, err
|
return lst, err
|
||||||
|
Loading…
Reference in New Issue
Block a user