BUG: getActiveDownloads makes redundant concurrent HTTP requests to SABnzbd queue endpoint #36
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Location
server/clients/SABnzbdClient.jsgetActiveDownloads) and lines 93-100 (withingetClientStatus)Issue Details
In
SABnzbdClient.js, thegetActiveDownloads()method initiates concurrent requests usingPromise.all:However, looking at the implementation of
getClientStatus():We see that
getClientStatus()internally makes the exact samethis.makeRequest({ mode: 'queue' })request.As a result, calling
getActiveDownloads()triggers two concurrent and identical requests to the SABnzbd/api?mode=queueendpoint during every polling cycle. This redundant HTTP overhead wastes SABnzbd instance CPU/memory resource, network bandwidth, and application memory, especially when polling frequently.Proposed Fix
Avoid calling
this.getClientStatus()concurrently ingetActiveDownloads()when we already have the queue response. Instead, extract the client status directly from the fetchedqueueResponsedata.Specifically, in
getActiveDownloads(), query queue and history in parallel, and then construct the clientStatus info directly fromqueueData.queue. This eliminates the redundant API request entirely.Resolved via commit
12c44a6(removed redundant getClientStatus call).