diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2022-02-01 15:28:05 +0300 |
---|---|---|
committer | Vladimir Shushlin <v.shushlin@gmail.com> | 2022-02-01 15:31:30 +0300 |
commit | 1b50e38f3959c784f44c280720ed3249802d2622 (patch) | |
tree | d8d5468d2f86b75ed72ab10e44b661543d3ca194 /internal/vfs | |
parent | be03f220910a2188d824f81612221db78f74ff2a (diff) |
fix: Fix 500 errors when clients disconnect
When clients disconnect, we now logging 500 error due to
Context.Cancelled error.
This leads to alerts and uses up our error budgets.
This reverts merge request !676
Changelog: fixed
Diffstat (limited to 'internal/vfs')
-rw-r--r-- | internal/vfs/serving/serving.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/internal/vfs/serving/serving.go b/internal/vfs/serving/serving.go index 57b0228f..6f45e1d5 100644 --- a/internal/vfs/serving/serving.go +++ b/internal/vfs/serving/serving.go @@ -47,17 +47,10 @@ func serveContent(w http.ResponseWriter, r *http.Request, modtime time.Time, con return } - if r.Method == http.MethodHead { - w.WriteHeader(code) - return - } + w.WriteHeader(code) if r.Method != http.MethodHead { - if _, err := io.Copy(w, content); err != nil { - errortracking.Capture(err, errortracking.WithRequest(r), errortracking.WithStackTrace()) - logging.LogRequest(r).WithError(err).Error("error serving content") - httperrors.Serve500(w) - } + io.Copy(w, content) } } |