Copy metadata before spawning goroutine + prealloc maps (#10458)

In `(*cacheObjects).GetObjectNInfo` copy the metadata before spawning a goroutine.

Clean up a few map[string]string copies as well, reducing allocs and simplifying the code.

Fixes #10426
This commit is contained in:
Klaus Post
2020-09-10 11:37:22 -07:00
committed by GitHub
parent ce6cef6855
commit b7438fe4e6
16 changed files with 47 additions and 63 deletions

View File

@@ -321,7 +321,7 @@ func compareSignatureV2(sig1, sig2 string) bool {
// Return canonical headers.
func canonicalizedAmzHeadersV2(headers http.Header) string {
var keys []string
keyval := make(map[string]string)
keyval := make(map[string]string, len(headers))
for key := range headers {
lkey := strings.ToLower(key)
if !strings.HasPrefix(lkey, "x-amz-") {