Skip to content

Commit

Permalink
Fix redirect code
Browse files Browse the repository at this point in the history
  • Loading branch information
anbsky committed Dec 4, 2024
1 parent b8c75fc commit 5932d86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion player/http_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func (h *RequestHandler) Handle(c *gin.Context) {
tcPath := h.player.tclient.GetPlaybackPath(c.Param("claim_id"), stream.hash)
if tcPath != "" {
metrics.StreamsDelivered.WithLabelValues(metrics.StreamTranscoded).Inc()
c.Redirect(http.StatusPermanentRedirect, getPlaylistURL(c.Request.URL.Path, c.Request.URL.Query(), tcPath, stream))
c.Redirect(http.StatusFound, getPlaylistURL(c.Request.URL.Path, c.Request.URL.Query(), tcPath, stream))
return
}
}
Expand Down
6 changes: 3 additions & 3 deletions player/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (s *Stream) prefetchChunk(chunkIdx int) {
return
}

Logger.Debugf("prefetching %v chunks to local cache", prefetchLen)
Logger.Debugf("prefetching %d chunks to local cache", prefetchLen)
for _, bi := range s.sdBlob.BlobInfos[chunkIdx : chunkIdx+prefetchLen] {
hash := hex.EncodeToString(bi.BlobHash)

Expand All @@ -258,10 +258,10 @@ func (s *Stream) prefetchChunk(chunkIdx int) {
continue
}

Logger.Debugf("prefetching chunk %v", hash)
Logger.Debugf("prefetching chunk %s", hash)
_, err := s.player.blobSource.GetChunk(hash, s.sdBlob.Key, bi.IV)
if err != nil {
Logger.Errorf("failed to prefetch chunk %v: %v", hash, errors.FullTrace(err))
Logger.Errorf("failed to prefetch chunk %s: %s", hash, err.Error())
return
}
}
Expand Down

0 comments on commit 5932d86

Please sign in to comment.