perf: reduce history page size from 100 to 20
All checks were successful
Build and Push Docker Image / build (push) Successful in 23s

- SABnzbd, Sonarr, and Radarr history now fetch 20 items instead of 100
- Only recent completions are needed for the dashboard
- Reduces response payload and serialization time
This commit is contained in:
2026-05-15 23:36:43 +01:00
parent 570eca0b82
commit 6baf643645

View File

@@ -148,7 +148,7 @@ router.get('/user-downloads', async (req, res) => {
const sabHistoryPromises = sabInstances.map(inst =>
axios.get(`${inst.url}/api`, {
params: { mode: 'history', apikey: inst.apiKey, output: 'json', limit: 100 }
params: { mode: 'history', apikey: inst.apiKey, output: 'json', limit: 20 }
}).then(res => ({ instance: inst.id, data: res.data })).catch(err => {
console.error(`[Dashboard] SABnzbd ${inst.id} history error:`, err.message);
return { instance: inst.id, data: { history: { slots: [] } } };
@@ -180,7 +180,7 @@ router.get('/user-downloads', async (req, res) => {
const sonarrHistoryPromises = sonarrInstances.map(inst =>
axios.get(`${inst.url}/api/v3/history`, {
headers: { 'X-Api-Key': inst.apiKey },
params: { pageSize: 100, includeSeries: true, includeEpisode: true }
params: { pageSize: 20, includeSeries: true, includeEpisode: true }
}).then(res => ({ instance: inst.id, data: res.data })).catch(err => {
console.error(`[Dashboard] Sonarr ${inst.id} history error:`, err.message);
return { instance: inst.id, data: { records: [] } };
@@ -212,7 +212,7 @@ router.get('/user-downloads', async (req, res) => {
const radarrHistoryPromises = radarrInstances.map(inst =>
axios.get(`${inst.url}/api/v3/history`, {
headers: { 'X-Api-Key': inst.apiKey },
params: { pageSize: 100, includeMovie: true }
params: { pageSize: 20, includeMovie: true }
}).then(res => ({ instance: inst.id, data: res.data })).catch(err => {
console.error(`[Dashboard] Radarr ${inst.id} history error:`, err.message);
return { instance: inst.id, data: { records: [] } };