[scraper] add jitter for eztv retries

This commit is contained in:
TheBeastLT
2020-04-23 22:56:12 +02:00
parent 5e25bac52a
commit eb2211ddcb
3 changed files with 16 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ const { updateTorrentSeeders } = require('../lib/torrentEntries')
const DELAY = 15 * 1000; // 15 seconds
const limiter = new Bottleneck({ maxConcurrent: 20, minTime: 250 });
const updateLimiter = new Bottleneck({ maxConcurrent: 20 });
const forceSeedersLimiter = new Bottleneck({ maxConcurrent: 5 });
function scheduleUpdateSeeders() {
@@ -37,7 +38,7 @@ async function _updateSeeders(torrent) {
.then(updated => updatedTorrents.push(updated));
}
return Promise.all(updatedTorrents.map(updated => updateTorrentSeeders(updated)))
return Promise.all(updatedTorrents.map(updated => updateLimiter.schedule(() => updateTorrentSeeders(updated))));
}
function getImdbIdsMethod(torrent) {