From a51ddc53c5f80a6695f8d04d552c09ac01e9ab12 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Sun, 21 Jan 2024 23:46:15 +0200 Subject: [PATCH] revert bypassing mongo --- addon/addon.js | 4 ++-- addon/lib/repository.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addon/addon.js b/addon/addon.js index 9e05053..f7566e0 100644 --- a/addon/addon.js +++ b/addon/addon.js @@ -29,10 +29,10 @@ builder.defineStreamHandler((args) => { return Promise.resolve({ streams: [] }); } - return limiter.schedule(limiterOptions, () => 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)))) + .map(record => toStreamInfo(record))))) .then(streams => applyFilters(streams, args.extra)) .then(streams => applySorting(streams, args.extra, args.type)) .then(streams => applyStaticInfo(streams)) diff --git a/addon/lib/repository.js b/addon/lib/repository.js index 003b2b5..594fef9 100644 --- a/addon/lib/repository.js +++ b/addon/lib/repository.js @@ -3,7 +3,7 @@ const Op = Sequelize.Op; const DATABASE_URI = process.env.DATABASE_URI; -const database = new Sequelize(DATABASE_URI, { logging: false, pool: { max: 100, evict: 120000} }); +const database = new Sequelize(DATABASE_URI, { logging: false, pool: { max: 50, evict: 120000 } }); const Torrent = database.define('torrent', {