From 8a4eb4cdfecc68f0d85f4dc86f50e1cd4e6401ee Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Fri, 19 Jan 2024 10:30:13 +0200 Subject: [PATCH] add limiter options --- addon/addon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/addon.js b/addon/addon.js index f7fb696..2ac3a9b 100644 --- a/addon/addon.js +++ b/addon/addon.js @@ -22,13 +22,14 @@ const limiter = new Bottleneck({ highWater: process.env.LIMIT_QUEUE_SIZE || 220, strategy: Bottleneck.strategy.OVERFLOW }); +const limiterOptions = { expiration: 2 * 60 * 1000 } builder.defineStreamHandler((args) => { if (!args.id.match(/tt\d+/i) && !args.id.match(/kitsu:\d+/i)) { return Promise.resolve({ streams: [] }); } - return cacheWrapStream(args.id, () => limiter.schedule(() => streamHandler(args) + return cacheWrapStream(args.id, () => limiter.schedule(limiterOptions, () => streamHandler(args) .then(records => records .sort((a, b) => b.torrent.seeders - a.torrent.seeders || b.torrent.uploadDate - a.torrent.uploadDate) .map(record => toStreamInfo(record)))))