mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
fix: optimize isConnected to avoid url.String() conversions (#9202)
Stringifying in a loop can tax the system, avoid this and convert the endpoints to strings early on and remember them for the lifetime of the server.
This commit is contained in:
@@ -171,7 +171,11 @@ func NewEndpoint(arg string) (ep Endpoint, e error) {
|
||||
if isHostIP(arg) {
|
||||
return ep, fmt.Errorf("invalid URL endpoint format: missing scheme http or https")
|
||||
}
|
||||
u = &url.URL{Path: path.Clean(arg)}
|
||||
absArg, err := filepath.Abs(arg)
|
||||
if err != nil {
|
||||
return Endpoint{}, fmt.Errorf("absolute path failed %s", err)
|
||||
}
|
||||
u = &url.URL{Path: path.Clean(absArg)}
|
||||
isLocal = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user