feat: share cache between top pick and top picks endpoints

This commit is contained in:
2026-07-05 22:06:00 +02:00
parent 57a6aa8f7a
commit 04a9b0b0bd

View File

@@ -32,7 +32,11 @@ type topPicksCache struct {
const topPicksRefreshTimeout = 30 * time.Second const topPicksRefreshTimeout = 30 * time.Second
func (s *animeService) GetTopPickForYou(_ context.Context, userID string) (domain.CatalogSectionData, error) { func (s *animeService) GetTopPickForYou(_ context.Context, userID string) (domain.CatalogSectionData, error) {
return s.getCachedTopPicksForYou(userID, recommendations.TopPickLimit), nil data := s.getCachedTopPicksForYou(userID, recommendations.TopPicksLimit)
if len(data.Animes) > recommendations.TopPickLimit {
data.Animes = data.Animes[:recommendations.TopPickLimit]
}
return data, nil
} }
func (s *animeService) GetTopPicksForYou(_ context.Context, userID string) (domain.CatalogSectionData, error) { func (s *animeService) GetTopPicksForYou(_ context.Context, userID string) (domain.CatalogSectionData, error) {