Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: close reponse body (#9554)

zll6002c429656fdcd
diff --git a/scripts/check_link_test.go b/scripts/check_link_test.go
index a5fbe2a603..a4b5f512cf 100644
--- a/scripts/check_link_test.go
+++ b/scripts/check_link_test.go
@@ -90,17 +90,28 @@ func extractLinkRecursive() (map[string]bool, error) {
func checkLinkWithRetry(link string) error {
for i := 0; i < 3; i++ {
- // Request the link and check the response status code is 200.
- res, err := http.Get(link)
+ success, err := checkLink(link)
if err != nil {
return errors.Wrapf(err, "failed to request link: %s", link)
}
- if res.StatusCode != http.StatusOK {
- time.Sleep(1 * time.Minute)
- continue
+ if success {
+ return nil
}
- return nil
+ time.Sleep(1 * time.Minute)
}
return errors.Errorf("Link %s is not reachable after %d retries", link, 3)
}
+
+func checkLink(link string) (bool, error) {
+ // Request the link and check the response status code is 200.
+ res, err := http.Get(link)
+ if err != nil {
+ return false, errors.Wrapf(err, "failed to request link: %s", link)
+ }
+ defer res.Body.Close()
+ if res.StatusCode != http.StatusOK {
+ return false, nil
+ }
+ return true, nil
+}