mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
fix: avoid audit log race protection deadlocks (#17168)
This commit is contained in:
@@ -124,7 +124,12 @@ func AuditLog(ctx context.Context, w http.ResponseWriter, r *http.Request, reqCl
|
||||
entry.API.HeaderBytes = headerBytes
|
||||
entry.API.TimeToResponse = strconv.FormatInt(timeToResponse.Nanoseconds(), 10) + "ns"
|
||||
entry.API.TimeToResponseInNS = strconv.FormatInt(timeToResponse.Nanoseconds(), 10)
|
||||
entry.Tags = reqInfo.GetTagsMap()
|
||||
// We hold the lock, so we cannot call reqInfo.GetTagsMap().
|
||||
tags := make(map[string]interface{}, len(reqInfo.tags))
|
||||
for _, t := range reqInfo.tags {
|
||||
tags[t.Key] = t.Val
|
||||
}
|
||||
entry.Tags = tags
|
||||
// ignore cases for ttfb when its zero.
|
||||
if timeToFirstByte != 0 {
|
||||
entry.API.TimeToFirstByte = strconv.FormatInt(timeToFirstByte.Nanoseconds(), 10) + "ns"
|
||||
|
||||
Reference in New Issue
Block a user