0.3.49
This commit is contained in:
@@ -135,6 +135,7 @@ func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, sess store.S
|
||||
forYouRows []recommend.Row
|
||||
forYouRowStale bool
|
||||
seriesPlayed map[string]time.Time
|
||||
surfacedReady []store.SurfacedReadyRequest
|
||||
ranking rankingInputs
|
||||
rowStats []store.RowStat
|
||||
rowStatsOK bool
|
||||
@@ -286,6 +287,24 @@ func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, sess store.S
|
||||
defer wg.Done()
|
||||
ranking = s.rankingInputs(ctx, sess.EmbyUserID)
|
||||
}()
|
||||
// The requests this viewer has asked for that have just become watchable, to be pinned
|
||||
// to the front of Continue Watching. Read beside the Emby fan-out, not after it: it is a
|
||||
// function of the viewer's id alone, and the overwhelmingly common answer is none.
|
||||
if continueWatching && s.store != nil {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
ready, err := s.store.SurfacedReadyRequests(ctx, sess.EmbyUserID)
|
||||
if err != nil {
|
||||
s.loggerFor(ctx).Warn("surfaced request arrivals unavailable",
|
||||
"user", sess.EmbyUserID, "error", err)
|
||||
return
|
||||
}
|
||||
mu.Lock()
|
||||
surfacedReady = ready
|
||||
mu.Unlock()
|
||||
}()
|
||||
}
|
||||
if s.store != nil {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
@@ -346,6 +365,12 @@ func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, sess store.S
|
||||
if continueWatching {
|
||||
out.ContinueWatching = prioritizeAiringTodayContinue(out.ContinueWatching, sonarrRow)
|
||||
}
|
||||
// A title this viewer requested that has just arrived is pinned to the front of the row
|
||||
// (or tagged in place if it is already there), so the request journey ends where they
|
||||
// look for something to watch rather than on the My Requests page.
|
||||
if continueWatching && len(surfacedReady) > 0 {
|
||||
out.ContinueWatching = s.injectRequestReady(ctx, cred, out.ContinueWatching, surfacedReady)
|
||||
}
|
||||
|
||||
// Recommendations are read from their own long-lived cache. A miss means this
|
||||
// response ships without them and a rebuild starts in the background — the home
|
||||
@@ -391,6 +416,7 @@ func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, sess store.S
|
||||
out.Rows = s.personalizeTitlesWith(out.Rows, ranking)
|
||||
out.Rows = personalizeRowsByTitleScores(selectPersonalizedRows(out.Rows))
|
||||
out.Rows = deduplicateRows(out.Rows)
|
||||
out.Rows = s.applyRowLayouts(ctx, out.Rows)
|
||||
rank()
|
||||
// Ratings ride on the cards themselves. Only what is already stored is attached, so
|
||||
// the launcher pays one indexed read rather than a request per poster, and a card
|
||||
@@ -422,7 +448,7 @@ func (s *Server) handleHome(w http.ResponseWriter, r *http.Request, sess store.S
|
||||
}
|
||||
// A partial payload is served but never cached: the next request should retry.
|
||||
if !out.Partial {
|
||||
if err := s.cache.Set(ctx, key, body, s.cfg.HomeTTL); err != nil {
|
||||
if err := s.cache.Set(ctx, key, body, s.homeTTL()); err != nil {
|
||||
s.loggerFor(ctx).Warn("home cache write failed", "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user