pass around correct endpoint while registering remote storage (#19710)

This commit is contained in:
Harshavardhana 2024-05-09 11:03:54 -07:00 committed by GitHub
parent e00de1c302
commit 7b7d2ea7d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -1367,7 +1367,7 @@ func registerStorageRESTHandlers(router *mux.Router, endpointServerPools Endpoin
OutCapacity: 1,
}), "unable to register handler")
createStorage := func(server *storageRESTServer) bool {
createStorage := func(endpoint Endpoint) bool {
xl, err := newXLStorage(endpoint, false)
if err != nil {
// if supported errors don't fail, we proceed to
@ -1391,19 +1391,19 @@ func registerStorageRESTHandlers(router *mux.Router, endpointServerPools Endpoin
return true
}
if createStorage(server) {
if createStorage(endpoint) {
continue
}
// Start async goroutine to create storage.
go func(server *storageRESTServer) {
go func(endpoint Endpoint) {
for {
time.Sleep(3 * time.Second)
if createStorage(server) {
if createStorage(endpoint) {
return
}
}
}(server)
}(endpoint)
}
}