diff --git a/addon/addon.js b/addon/addon.js index ee9e684..f7fb696 100644 --- a/addon/addon.js +++ b/addon/addon.js @@ -12,13 +12,14 @@ import StaticLinks from './moch/static.js'; const CACHE_MAX_AGE = parseInt(process.env.CACHE_MAX_AGE) || 60 * 60; // 1 hour in seconds const CACHE_MAX_AGE_EMPTY = 60; // 60 seconds +const CATALOG_CACHE_MAX_AGE = 20 * 60; // 20 minutes const STALE_REVALIDATE_AGE = 4 * 60 * 60; // 4 hours const STALE_ERROR_AGE = 7 * 24 * 60 * 60; // 7 days const builder = new addonBuilder(dummyManifest()); const limiter = new Bottleneck({ - maxConcurrent: process.env.LIMIT_MAX_CONCURRENT || 50, - highWater: process.env.LIMIT_QUEUE_SIZE || 50, + maxConcurrent: process.env.LIMIT_MAX_CONCURRENT || 200, + highWater: process.env.LIMIT_QUEUE_SIZE || 220, strategy: Bottleneck.strategy.OVERFLOW }); @@ -47,7 +48,7 @@ builder.defineCatalogHandler((args) => { return getMochCatalog(mochKey, args.extra) .then(metas => ({ metas: metas, - cacheMaxAge: 0 + cacheMaxAge: CATALOG_CACHE_MAX_AGE })) .catch(error => { return Promise.reject(`Failed retrieving catalog ${args.id}: ${JSON.stringify(error)}`); diff --git a/addon/moch/moch.js b/addon/moch/moch.js index bc0bf99..0dfb1e4 100644 --- a/addon/moch/moch.js +++ b/addon/moch/moch.js @@ -64,7 +64,7 @@ Object.values(MochOptions) .map(moch => moch.key) .forEach(mochKey => unrestrictQueues[mochKey] = new namedQueue((task, callback) => task.method() .then(result => callback(false, result)) - .catch((error => callback(error))), 40)); + .catch((error => callback(error))), 200)); export function hasMochConfigured(config) { return Object.keys(MochOptions).find(moch => config?.[moch]) diff --git a/addon/moch/realdebrid.js b/addon/moch/realdebrid.js index ed51148..6aaa7a3 100644 --- a/addon/moch/realdebrid.js +++ b/addon/moch/realdebrid.js @@ -395,5 +395,5 @@ function infringingFile(error) { } async function getDefaultOptions(ip) { - return { ip, timeout: 5000 }; + return { ip, timeout: 10000 }; }