allow resultCh to be closed() after clusterMetaHealthInfo() (#16073)

This commit is contained in:
jiuker
2022-11-16 19:04:36 +08:00
committed by GitHub
parent 4c9cac0b47
commit 3597af789e

View File

@@ -2613,7 +2613,10 @@ func getClusterMetaInfo(ctx context.Context) []byte {
defer cancel()
resultCh := make(chan madmin.ClusterRegistrationInfo)
go func() {
defer close(resultCh)
ci := madmin.ClusterRegistrationInfo{}
ci.Info.NoOfServerPools = len(globalEndpoints)
ci.Info.NoOfServers = len(globalEndpoints.Hostnames())
@@ -2635,7 +2638,12 @@ func getClusterMetaInfo(ctx context.Context) []byte {
ci.DeploymentID = globalDeploymentID
ci.ClusterName = fmt.Sprintf("%d-servers-%d-disks-%s", ci.Info.NoOfServers, ci.Info.NoOfDrives, ci.Info.MinioVersion)
resultCh <- ci
select {
case resultCh <- ci:
case <-ctx.Done():
return
}
}()
select {