Promise pool

This commit is contained in:
Senad Uka
2020-09-10 19:39:13 +02:00
parent 26377c485c
commit e4775158fc
4 changed files with 25 additions and 2 deletions

View File

@@ -25,8 +25,6 @@ const fetch = async (url, options = {}) => {
const urlAdaptedForScraping = USE_SCRAPER_API
? `${SCRAPER_API_BASE_URL}?api_key=${SCRAPER_API_KEY}&url=${urlToFetchThroughAPI}`
: url;
const randomPauseMS = Math.floor(Math.random() * Math.floor(1500)) + 500;
await timeout(randomPauseMS);
return nodeFetch(urlAdaptedForScraping, newOptions);
};