fix: stop stale request retries
This commit is contained in:
@@ -2,6 +2,7 @@ package anime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mal/integrations/jikan"
|
||||
"mal/internal/domain"
|
||||
@@ -181,6 +182,9 @@ func (h *AnimeHandler) handleAnimeDetailsSection(c *gin.Context, id int, section
|
||||
|
||||
data, tplName, err := h.loadAnimeDetailsSection(sectionCtx, id, section)
|
||||
if err != nil {
|
||||
if errors.Is(err, context.Canceled) {
|
||||
return
|
||||
}
|
||||
observability.Warn(
|
||||
"anime_section_fetch_failed",
|
||||
"anime",
|
||||
|
||||
@@ -48,6 +48,9 @@ func (h *PlaybackHandler) HandleProxyStream(c *gin.Context) {
|
||||
copyProxyHeaders(c.Writer.Header(), resp.Header)
|
||||
c.Status(resp.StatusCode)
|
||||
if n, err := io.Copy(c.Writer, resp.Body); err != nil {
|
||||
if errors.Is(err, context.Canceled) || c.Request.Context().Err() != nil {
|
||||
return
|
||||
}
|
||||
observability.WarnContext(c.Request.Context(), "proxy_stream_copy_failed", "playback", "", map[string]any{"target_url": targetURL, "bytes_copied": n}, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user