feat: timeout on check
This commit is contained in:
parent
a0b775a7c0
commit
4a8f032304
1 changed files with 5 additions and 1 deletions
|
@ -86,7 +86,11 @@ func (hc *HealthCheck) execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testHealth(serverURL *url.URL, checkURL string) bool {
|
func testHealth(serverURL *url.URL, checkURL string) bool {
|
||||||
resp, err := http.Get(serverURL.String() + checkURL)
|
timeout := time.Duration(5 * time.Second)
|
||||||
|
client := http.Client{
|
||||||
|
Timeout: timeout,
|
||||||
|
}
|
||||||
|
resp, err := client.Get(serverURL.String() + checkURL)
|
||||||
if err != nil || resp.StatusCode != 200 {
|
if err != nil || resp.StatusCode != 200 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue