fix: add debug logs to plex watchlist

This commit is contained in:
gauthier-th
2025-10-02 16:05:21 +02:00
parent f2bd0abcd8
commit ca9074b111

View File

@@ -277,9 +277,18 @@ class PlexTvAPI extends ExternalAPI {
}> {
try {
const watchlistCache = cacheManager.getCache('plexwatchlist');
logger.debug('Fetching watchlist from Plex.TV', {
offset,
size,
label: 'Plex.TV Metadata API',
});
let cachedWatchlist = watchlistCache.data.get<PlexWatchlistCache>(
this.authToken
);
logger.debug(`Found cached watchlist: ${!!cachedWatchlist}`, {
cachedWatchlist,
label: 'Plex.TV Metadata API',
});
const response = await this.axios.get<WatchlistResponse>(
'/library/sections/watchlist/all',
@@ -296,6 +305,10 @@ class PlexTvAPI extends ExternalAPI {
}
);
logger.debug(`Watchlist fetch returned status ${response.status}`, {
label: 'Plex.TV Metadata API',
});
// If we don't recieve HTTP 304, the watchlist has been updated and we need to update the cache.
if (response.status >= 200 && response.status <= 299) {
cachedWatchlist = {