0.2.59 - Settings save fixes
This commit is contained in:
@@ -110,6 +110,10 @@ func (s *Server) handleRadarrImage(w http.ResponseWriter, r *http.Request, itemI
|
||||
writeError(w, http.StatusNotFound, "image not found")
|
||||
return
|
||||
}
|
||||
if clientGaveUp(r.Context(), err) {
|
||||
writeError(w, statusClientClosedRequest, "the request was abandoned")
|
||||
return
|
||||
}
|
||||
s.log.Warn("radarr image failed", "movie_id", movieID, "type", coverType, "error", err)
|
||||
writeError(w, http.StatusBadGateway, "could not load the image")
|
||||
return
|
||||
@@ -154,6 +158,10 @@ func (s *Server) handleSonarrImage(w http.ResponseWriter, r *http.Request, itemI
|
||||
writeError(w, http.StatusNotFound, "image not found")
|
||||
return
|
||||
}
|
||||
if clientGaveUp(r.Context(), err) {
|
||||
writeError(w, statusClientClosedRequest, "the request was abandoned")
|
||||
return
|
||||
}
|
||||
s.log.Warn("sonarr image failed", "series_id", seriesID, "type", coverType, "error", err)
|
||||
writeError(w, http.StatusBadGateway, "could not load the image")
|
||||
return
|
||||
@@ -192,7 +200,17 @@ func copyImage(
|
||||
}
|
||||
|
||||
func expectedClientDisconnect(r *http.Request, err error) bool {
|
||||
if r.Context().Err() != nil ||
|
||||
return clientGaveUp(r.Context(), err)
|
||||
}
|
||||
|
||||
// clientGaveUp reports whether a failure is the television having walked away rather than
|
||||
// anything being wrong here.
|
||||
//
|
||||
// A cancellation is the *only* thing it treats as such. A deadline is our own patience
|
||||
// running out, which is a real failure with a real cause; conflating the two would hide
|
||||
// exactly the timeouts worth seeing.
|
||||
func clientGaveUp(ctx context.Context, err error) bool {
|
||||
if errors.Is(ctx.Err(), context.Canceled) ||
|
||||
errors.Is(err, context.Canceled) ||
|
||||
errors.Is(err, net.ErrClosed) ||
|
||||
errors.Is(err, syscall.EPIPE) ||
|
||||
|
||||
Reference in New Issue
Block a user