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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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