diff --git a/server/api/externalapi.ts b/server/api/externalapi.ts index 4f0ded026..0dfddefc9 100644 --- a/server/api/externalapi.ts +++ b/server/api/externalapi.ts @@ -76,7 +76,7 @@ class ExternalAPI { } const data = await this.getDataFromResponse(response); - if (this.cache) { + if (this.cache && ttl !== 0) { this.cache.set(cacheKey, data, ttl ?? DEFAULT_TTL); } @@ -120,7 +120,7 @@ class ExternalAPI { } const resData = await this.getDataFromResponse(response); - if (this.cache) { + if (this.cache && ttl !== 0) { this.cache.set(cacheKey, resData, ttl ?? DEFAULT_TTL); } @@ -164,7 +164,7 @@ class ExternalAPI { } const resData = await this.getDataFromResponse(response); - if (this.cache) { + if (this.cache && ttl !== 0) { this.cache.set(cacheKey, resData, ttl ?? DEFAULT_TTL); } diff --git a/server/api/servarr/base.ts b/server/api/servarr/base.ts index ae024b6e8..8b0d5ca09 100644 --- a/server/api/servarr/base.ts +++ b/server/api/servarr/base.ts @@ -157,9 +157,13 @@ class ServarrBase extends ExternalAPI { public getQueue = async (): Promise<(QueueItem & QueueItemAppendT)[]> => { try { - const data = await this.get>(`/queue`, { - includeEpisode: 'true', - }); + const data = await this.get>( + `/queue`, + { + includeEpisode: 'true', + }, + 0 + ); return data.records; } catch (e) { @@ -193,15 +197,24 @@ class ServarrBase extends ExternalAPI { } }; + async refreshMonitoredDownloads(): Promise { + await this.runCommand('RefreshMonitoredDownloads', {}); + } + protected async runCommand( commandName: string, options: Record ): Promise { try { - await this.post(`/command`, { - name: commandName, - ...options, - }); + await this.post( + `/command`, + { + name: commandName, + ...options, + }, + {}, + 0 + ); } catch (e) { throw new Error(`[${this.apiName}] Failed to run command: ${e.message}`); } diff --git a/server/lib/downloadtracker.ts b/server/lib/downloadtracker.ts index e948c5805..b96bfca8d 100644 --- a/server/lib/downloadtracker.ts +++ b/server/lib/downloadtracker.ts @@ -85,6 +85,7 @@ class DownloadTracker { }); try { + await radarr.refreshMonitoredDownloads(); const queueItems = await radarr.getQueue(); this.radarrServers[server.id] = queueItems.map((item) => ({ @@ -162,6 +163,7 @@ class DownloadTracker { }); try { + await sonarr.refreshMonitoredDownloads(); const queueItems = await sonarr.getQueue(); this.sonarrServers[server.id] = queueItems.map((item) => ({