diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index dd8eedf1c..32ebd6732 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1570,6 +1570,8 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque servers := globalNotificationSys.ServerInfo() servers = append(servers, server) + assignPoolNumbers(servers) + var backend interface{} mode := madmin.ObjectLayerInitializing @@ -1651,6 +1653,22 @@ func (a adminAPIHandlers) ServerInfoHandler(w http.ResponseWriter, r *http.Reque writeSuccessResponseJSON(w, jsonBytes) } +func assignPoolNumbers(servers []madmin.ServerProperties) { + for i := range servers { + for idx, ge := range globalEndpoints { + for _, endpoint := range ge.Endpoints { + if servers[i].Endpoint == endpoint.Host { + servers[i].PoolNumber = idx + 1 + } else if host, err := xnet.ParseHost(servers[i].Endpoint); err == nil { + if host.Name == endpoint.Hostname() { + servers[i].PoolNumber = idx + 1 + } + } + } + } + } +} + func fetchLambdaInfo() []map[string][]madmin.TargetIDStatus { lambdaMap := make(map[string][]madmin.TargetIDStatus) diff --git a/cmd/notification.go b/cmd/notification.go index e255b8464..8ecd4933e 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -1240,20 +1240,6 @@ func (sys *NotificationSys) ServerInfo() []madmin.ServerProperties { } wg.Wait() - for i := range reply { - for j := range globalEndpoints { - for _, endpoint := range globalEndpoints[j].Endpoints { - if reply[i].Endpoint == endpoint.Host { - reply[i].PoolNumber = j + 1 - } else if host, err := xnet.ParseHost(reply[i].Endpoint); err == nil { - if host.Name == endpoint.Hostname() { - reply[i].PoolNumber = j + 1 - } - } - } - } - } - return reply }