Merge branch 'TheBeastLT:master' into master

This commit is contained in:
Gabisonfire
2024-01-22 09:24:25 -05:00
committed by GitHub
3 changed files with 7 additions and 5 deletions

View File

@@ -18,17 +18,18 @@ 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 || 200,
highWater: process.env.LIMIT_QUEUE_SIZE || 220,
maxConcurrent: process.env.LIMIT_MAX_CONCURRENT || 100,
highWater: process.env.LIMIT_QUEUE_SIZE || 120,
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)))))

View File

@@ -29,7 +29,8 @@ function initiateRemoteCache() {
uri: MONGO_URI,
options: {
collection: 'torrentio_addon_collection',
socketTimeoutMS: 120000,
socketTimeoutMS: 30000,
poolSize: 150,
useNewUrlParser: true,
useUnifiedTopology: false,
ttl: STREAM_EMPTY_TTL

View File

@@ -3,7 +3,7 @@ const Op = Sequelize.Op;
const DATABASE_URI = process.env.DATABASE_URI;
const database = new Sequelize(DATABASE_URI, { logging: false });
const database = new Sequelize(DATABASE_URI, { logging: false, pool: { max: 50 } });
const Torrent = database.define('torrent',
{