From 00f179450b7930185bfdd24a9b54c2149a352f4d Mon Sep 17 00:00:00 2001 From: hanzhixiao <709674996@qq.com> Date: Thu, 10 Aug 2023 17:19:33 +0800 Subject: [PATCH] new_815 Signed-off-by: hanzhixiao <709674996@qq.com> --- tools/component/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/component/main.go b/tools/component/main.go index 68a4b7877..bc60b8140 100644 --- a/tools/component/main.go +++ b/tools/component/main.go @@ -193,13 +193,17 @@ func checkMinio() error { } cancel, err := minioClient.HealthCheck(time.Duration(minioHealthCheckDuration) * time.Second) + defer func() { + if cancel != nil { + cancel() + } + }() if err != nil { return err } else { if minioClient.IsOffline() { return ErrComponentStart.Wrap("Minio server is offline") } - cancel() } if exactIP(config.Config.Object.ApiURL) == "127.0.0.1" || exactIP(config.Config.Object.Minio.Endpoint) == "127.0.0.1" { return ErrConfig.Wrap("apiURL or Minio endpoint contain 127.0.0.1.")