BUG: getDownloadsByClientType executes sequential blocking awaits on download clients instead of parallel promises #35
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/utils/downloadClients.jsgetDownloadsByClientType)server/utils/poller.js(line 112)Issue Details
In
DownloadClientRegistry.getDownloadsByClientType(), the method retrieves all configured download clients and iterates over them sequentially using afor (const client of clients)loop:Because of the sequential
await client.getActiveDownloads();, if one client is slow, unresponsive, or experiencing network/timeout issues, the entire polling cycle is blocked. If multiple clients timeout, the latency accumulates linearly.In contrast,
getAllDownloads()correctly usesPromise.allSettledto query all clients in parallel and then aggregates the results, which prevents a single slow client from stalling the entire system.Because the main background poller at
server/utils/poller.jsrelies directly ongetDownloadsByClientType()to update active downloads, this sequential behavior has a severe performance impact on the dashboard, making real-time SSE updates sluggish or completely stalled.Proposed Fix
Refactor
getDownloadsByClientType()to query all clients concurrently usingPromise.allSettled, and then group the resolved downloads by client type.Resolved via commit
12c44a6(parallel polling).