Skip to content
Snippets Groups Projects
Commit 32b7da1b authored by Naman Jagdish Gala's avatar Naman Jagdish Gala 💬 Committed by Vladimir Shushlin
Browse files

Add recorder slowlogs in serveContent method

parent 8cd7c1a5
No related branches found
No related tags found
1 merge request!1112Add recorder slowlogs in serveContent method
......@@ -57,6 +57,11 @@ func serveContent(w http.ResponseWriter, r *http.Request, modtime time.Time, con
return
}
handleContentCopy(w, r, content)
}
func handleContentCopy(w http.ResponseWriter, r *http.Request, content vfs.File) {
defer slowlogs.Recorder(r.Context(), "serving.handleContentCopy")()
if _, err := io.Copy(w, content); err != nil {
if errors.Is(err, &vfs.ReadError{}) {
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
......@@ -253,6 +258,7 @@ func writeNotModified(w http.ResponseWriter) {
// checkPreconditions evaluates request preconditions and reports whether a precondition
// resulted in sending StatusNotModified or StatusPreconditionFailed.
func checkPreconditions(w http.ResponseWriter, r *http.Request, modtime time.Time) (done bool) {
defer slowlogs.Recorder(r.Context(), "serving.checkPreconditions")()
// This function carefully follows RFC 7232 section 6.
ch := checkIfMatch(w, r)
if ch == condNone {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment