fix: QBittorrent fallback state corruption after full sync #23
@@ -159,6 +159,11 @@ class QBittorrentClient extends DownloadClient {
|
|||||||
if (this.fallbackThisCycle) {
|
if (this.fallbackThisCycle) {
|
||||||
logToFile(`[qBittorrent:${this.name}] Already fell back this cycle, using legacy`);
|
logToFile(`[qBittorrent:${this.name}] Already fell back this cycle, using legacy`);
|
||||||
const torrents = await this.getTorrentsLegacy();
|
const torrents = await this.getTorrentsLegacy();
|
||||||
|
this.torrentMap = new Map();
|
||||||
|
for (const torrent of torrents) {
|
||||||
|
this.torrentMap.set(torrent.hash, torrent);
|
||||||
|
}
|
||||||
|
this.lastRid = 0;
|
||||||
return torrents.map(torrent => this.normalizeDownload(torrent));
|
return torrents.map(torrent => this.normalizeDownload(torrent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +175,11 @@ class QBittorrentClient extends DownloadClient {
|
|||||||
this.fallbackThisCycle = true;
|
this.fallbackThisCycle = true;
|
||||||
try {
|
try {
|
||||||
const torrents = await this.getTorrentsLegacy();
|
const torrents = await this.getTorrentsLegacy();
|
||||||
|
this.torrentMap = new Map();
|
||||||
|
for (const torrent of torrents) {
|
||||||
|
this.torrentMap.set(torrent.hash, torrent);
|
||||||
|
}
|
||||||
|
this.lastRid = 0;
|
||||||
return torrents.map(torrent => this.normalizeDownload(torrent));
|
return torrents.map(torrent => this.normalizeDownload(torrent));
|
||||||
} catch (fallbackError) {
|
} catch (fallbackError) {
|
||||||
logToFile(`[qBittorrent:${this.name}] Fallback also failed: ${fallbackError.message}`);
|
logToFile(`[qBittorrent:${this.name}] Fallback also failed: ${fallbackError.message}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user