perf: persist qBittorrent clients between requests
All checks were successful
Build and Push Docker Image / build (push) Successful in 27s
All checks were successful
Build and Push Docker Image / build (push) Successful in 27s
- Reuse client instances so auth cookies survive across requests - Eliminates redundant login round-trips on every dashboard refresh - Clients still re-authenticate automatically if session expires (403)
This commit is contained in:
@@ -96,14 +96,19 @@ class QBittorrentClient {
|
||||
}
|
||||
}
|
||||
|
||||
// Persist clients so auth cookies survive between requests
|
||||
let persistedClients = null;
|
||||
|
||||
function getClients() {
|
||||
if (persistedClients) return persistedClients;
|
||||
const instances = getQbittorrentInstances();
|
||||
if (instances.length === 0) {
|
||||
logToFile('[qBittorrent] No instances configured');
|
||||
return [];
|
||||
}
|
||||
logToFile(`[qBittorrent] Created ${instances.length} client(s)`);
|
||||
return instances.map(inst => new QBittorrentClient(inst));
|
||||
logToFile(`[qBittorrent] Created ${instances.length} persistent client(s)`);
|
||||
persistedClients = instances.map(inst => new QBittorrentClient(inst));
|
||||
return persistedClients;
|
||||
}
|
||||
|
||||
async function getAllTorrents() {
|
||||
|
||||
Reference in New Issue
Block a user