Use one http response recorder per external http call (#16938)

This commit is contained in:
Anis Eleuch
2023-03-31 17:37:29 +01:00
committed by GitHub
parent 216a471bbb
commit d90d0c8931
5 changed files with 32 additions and 21 deletions

View File

@@ -355,11 +355,11 @@ func collectAPIStats(api string, f http.HandlerFunc) http.HandlerFunc {
globalHTTPStats.currentS3Requests.Inc(api)
defer globalHTTPStats.currentS3Requests.Dec(api)
statsWriter := xhttp.NewResponseRecorder(w)
f.ServeHTTP(w, r)
f.ServeHTTP(statsWriter, r)
globalHTTPStats.updateStats(api, r, statsWriter)
if sw, ok := w.(*xhttp.ResponseRecorder); ok {
globalHTTPStats.updateStats(api, r, sw)
}
}
}