From b8265f1db13c472e27d0d166887209f794662713 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Thu, 8 Dec 2022 18:45:07 +0100 Subject: [PATCH] move AD retry condition to correct place --- addon/moch/alldebrid.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addon/moch/alldebrid.js b/addon/moch/alldebrid.js index 7580126..10f7d40 100644 --- a/addon/moch/alldebrid.js +++ b/addon/moch/alldebrid.js @@ -85,6 +85,9 @@ async function resolve({ ip, apiKey, infoHash, cachedEntryInfo, fileIndex }) { if (errorExpiredSubscriptionError(error)) { console.log(`Access denied to AllDebrid ${infoHash} [${fileIndex}]`); return StaticResponse.FAILED_ACCESS; + } else if (error.code === 'MAGNET_TOO_MANY') { + console.log(`Deleting and retrying adding to AllDebrid ${infoHash} [${fileIndex}]...`); + return _deleteAndRetry(AD, infoHash, cachedEntryInfo, fileIndex); } return Promise.reject(`Failed AllDebrid adding torrent ${JSON.stringify(error)}`); }); @@ -100,9 +103,6 @@ async function _resolve(AD, infoHash, cachedEntryInfo, fileIndex) { } else if (torrent && statusHandledError(torrent.statusCode)) { console.log(`Retrying downloading to AllDebrid ${infoHash} [${fileIndex}]...`); return _retryCreateTorrent(AD, infoHash, cachedEntryInfo, fileIndex); - } else if (torrent && torrent.code === 'MAGNET_TOO_MANY') { - console.log(`Deleting and retrying adding to AllDebrid ${infoHash} [${fileIndex}]...`); - return _deleteAndRetry(AD, infoHash, cachedEntryInfo, fileIndex); } return Promise.reject(`Failed AllDebrid adding torrent ${JSON.stringify(torrent)}`);