1
0
Fork 0

Set timeout 1 second for GatherStatus().

This commit is contained in:
Alexander Andreev 2023-12-16 04:27:03 +04:00
parent 86fdf05322
commit 34d469319d
Signed by: Arav
GPG Key ID: D22A817D95815393
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package servicestat
import (
"encoding/json"
"net/http"
"time"
)
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.Header.Set("Content-Type", "application/json")
cl := &http.Client{}
cl := &http.Client{Timeout: 1 * time.Second}
r, err := cl.Do(rq)
if err != nil {
return lst, err