0.2.81
This commit is contained in:
@@ -29,11 +29,13 @@ func (s *Server) handleActiveHero(w http.ResponseWriter, r *http.Request, sess s
|
||||
return
|
||||
}
|
||||
now := time.Now()
|
||||
location := s.cfg.RadarrLocation
|
||||
if location == nil {
|
||||
location = time.Local
|
||||
}
|
||||
key := cache.UserKey(sess.EmbyUserID, "hero:active:v1:"+placement+":"+heroRotationSlot(now, location))
|
||||
location := s.heroLocation()
|
||||
// Keyed by the revision the status poll publishes, which already carries the rotation
|
||||
// slot. That is what makes an operator's change reachable immediately without dropping
|
||||
// anything else the household has cached: the old entry is not invalidated, it is
|
||||
// simply no longer named. See heroRevision.
|
||||
key := cache.UserKey(sess.EmbyUserID, "hero:active:v2:"+placement+":"+
|
||||
heroRevision(s.currentHeroPolicy(r.Context()), sess.EmbyUserID, now, location))
|
||||
if raw, err := s.cache.Get(r.Context(), key); err == nil {
|
||||
w.Header().Set("X-Memby-Cache", "hit")
|
||||
writeRaw(w, http.StatusOK, raw)
|
||||
@@ -75,17 +77,10 @@ func (s *Server) resolveActiveHero(ctx context.Context, sess store.Session, plac
|
||||
s.decorateItemRatings(ctx, result.Items)
|
||||
rows := []recommend.Row{{ID: "hero-candidates-" + placement, Kind: "catalogue", Items: result.Items}}
|
||||
|
||||
policy, err := s.store.HeroPolicy(ctx)
|
||||
if err != nil {
|
||||
s.loggerFor(ctx).Warn("section hero policy unavailable", "placement", placement, "error", err)
|
||||
policy = store.HeroPolicy{}
|
||||
}
|
||||
policy := s.currentHeroPolicy(ctx)
|
||||
placementPolicy := policy.Placement(placement)
|
||||
pinned := filterHeroPlacement(s.pinnedHeroCandidates(ctx, placementPolicy.PinnedItemIDs), placement)
|
||||
location := s.cfg.RadarrLocation
|
||||
if location == nil {
|
||||
location = time.Local
|
||||
}
|
||||
location := s.heroLocation()
|
||||
scheduledIDs := activeHeroScheduleIDs(policy.Schedules, placement, sess.EmbyUserID, now, location)
|
||||
scheduled := filterHeroPlacement(s.pinnedHeroCandidates(ctx, scheduledIDs), placement)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user