use GlobalContext whenever possible (#9280)

This change is throughout the codebase to
ensure that all codepaths honor GlobalContext
This commit is contained in:
Harshavardhana
2020-04-09 09:30:02 -07:00
committed by GitHub
parent 1b45be0d60
commit f44cfb2863
76 changed files with 374 additions and 409 deletions

View File

@@ -51,7 +51,7 @@ func parseLocationConstraint(r *http.Request) (location string, s3Error APIError
locationConstraint := createBucketLocationConfiguration{}
err := xmlDecoder(r.Body, &locationConstraint, r.ContentLength)
if err != nil && r.ContentLength != 0 {
logger.LogIf(context.Background(), err)
logger.LogIf(GlobalContext, err)
// Treat all other failures as XML parsing errors.
return "", ErrMalformedXML
} // else for both err as nil or io.EOF
@@ -431,7 +431,7 @@ func getResource(path string, host string, domains []string) (string, error) {
if host, _, err = net.SplitHostPort(host); err != nil {
reqInfo := (&logger.ReqInfo{}).AppendTags("host", host)
reqInfo.AppendTags("path", path)
ctx := logger.SetReqInfo(context.Background(), reqInfo)
ctx := logger.SetReqInfo(GlobalContext, reqInfo)
logger.LogIf(ctx, err)
return "", err
}