Skip to content

Commit

Permalink
🐛 checker
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay committed Dec 2, 2023
1 parent e08af07 commit a8cf79c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/checker/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func ping(client *http.Client, inputData InputData) (PingData, error) {
latency := time.Since(start).Milliseconds()
defer response.Body.Close()

_, err = io.ReadAll(response.Body)
if err != nil {
if urlErr, ok := err.(*url.Error); ok {
if urlErr.Timeout() {
Expand All @@ -101,9 +100,14 @@ func ping(client *http.Client, inputData InputData) (PingData, error) {
}
}

return PingData{}, fmt.Errorf("Error while reading body from %s: %w", inputData.Url, err)
return PingData{}, fmt.Errorf("Error with monitor %s: %w", inputData.Url, err)
}

_, err = io.ReadAll(response.Body)

if err != nil {
return PingData{}, fmt.Errorf("Error while reading body from %s: %w", inputData.Url, err)
}
return PingData{
Latency: latency,
StatusCode: response.StatusCode,
Expand Down

0 comments on commit a8cf79c

Please sign in to comment.