mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 12:40:24 +03: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:
+5
-1
@@ -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