This commit is contained in:
ponzischeme89
2026-08-19 14:25:44 +12:00
parent 2b43b9ef12
commit 590e069366
83 changed files with 8948 additions and 1266 deletions
+16 -5
View File
@@ -331,14 +331,25 @@ func (s *Server) radarrMovieCatalogue(ctx context.Context) ([]radarr.Movie, erro
if err != nil {
return nil, err
}
if body, marshalErr := json.Marshal(movies); marshalErr == nil {
if cacheErr := s.cache.Set(ctx, radarrMovieCacheKey, body, s.cfg.RadarrTTL); cacheErr != nil {
s.loggerFor(ctx).Warn("radarr movie cache write failed", "error", cacheErr)
}
}
s.cacheRadarrMovies(ctx, movies)
return movies, nil
}
// cacheRadarrMovies stores the household's shared copy of Radarr's catalogue.
//
// Split out because the scheduled refresh writes it too: that task reads Radarr directly
// — a refresh satisfied by the cache it exists to replace would do nothing — and would
// otherwise need its own copy of the key, the TTL and the failure handling.
func (s *Server) cacheRadarrMovies(ctx context.Context, movies []radarr.Movie) {
body, err := json.Marshal(movies)
if err != nil {
return
}
if cacheErr := s.cache.Set(ctx, radarrMovieCacheKey, body, s.cfg.RadarrTTL); cacheErr != nil {
s.loggerFor(ctx).Warn("radarr movie cache write failed", "error", cacheErr)
}
}
func (s *Server) cachedRadarrMovies(ctx context.Context) []radarr.Movie {
raw, err := s.cache.Get(ctx, radarrMovieCacheKey)
if err != nil {