From 34d469319d4eacf1c31e78a8a2e598e62d2d742f Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 16 Dec 2023 04:27:03 +0400 Subject: [PATCH] Set timeout 1 second for GatherStatus(). --- pkg/servicestat/list.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/servicestat/list.go b/pkg/servicestat/list.go index b481aef..5969a80 100644 --- a/pkg/servicestat/list.go +++ b/pkg/servicestat/list.go @@ -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