This commit is contained in:
@@ -45,15 +45,32 @@ class SABnzbdClient extends DownloadClient {
|
||||
async getActiveDownloads() {
|
||||
try {
|
||||
// Get both queue and history to provide complete picture
|
||||
const [queueResponse, historyResponse, clientStatus] = await Promise.all([
|
||||
const [queueResponse, historyResponse] = await Promise.all([
|
||||
this.makeRequest({ mode: 'queue' }),
|
||||
this.makeRequest({ mode: 'history', limit: 10 }),
|
||||
this.getClientStatus()
|
||||
this.makeRequest({ mode: 'history', limit: 10 })
|
||||
]);
|
||||
|
||||
const queueData = queueResponse.data;
|
||||
const historyData = historyResponse.data;
|
||||
|
||||
// Extract client status directly from the fetched queue data instead of making a redundant HTTP request
|
||||
let clientStatus = null;
|
||||
if (queueData && queueData.queue) {
|
||||
const q = queueData.queue;
|
||||
clientStatus = {
|
||||
status: q.status,
|
||||
speed: q.speed,
|
||||
kbpersec: q.kbpersec,
|
||||
sizeleft: q.sizeleft,
|
||||
mbleft: q.mbleft,
|
||||
mb: q.mb,
|
||||
diskspace1: q.diskspace1,
|
||||
diskspace2: q.diskspace2,
|
||||
loadavg: q.loadavg,
|
||||
pause_int: q.pause_int
|
||||
};
|
||||
}
|
||||
|
||||
const downloads = [];
|
||||
|
||||
// Process active queue items
|
||||
|
||||
Reference in New Issue
Block a user