From ca6285eff2f90b7f2b27c1a61242a84a0b43d265 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Fri, 18 Sep 2020 22:41:53 +0200 Subject: [PATCH] [addon] retry on rd read timeout --- addon/moch/realdebrid.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addon/moch/realdebrid.js b/addon/moch/realdebrid.js index ac7251a..7cf31ee 100644 --- a/addon/moch/realdebrid.js +++ b/addon/moch/realdebrid.js @@ -40,6 +40,9 @@ async function _getInstantAvailable(hashes, apiKey, retries = 3) { blacklistProxy(options.proxy); return uncacheProxy('moch').then(() => _getInstantAvailable(hashes, apiKey, retries - 1)); } + if (retries > 0 && ['ESOCKETTIMEDOUT'].some(v => error.message && error.message.includes(v))) { + return _getInstantAvailable(hashes, apiKey, retries - 1); + } console.warn('Failed RealDebrid cached torrent availability request: ', error); return undefined; });