try to disable remote mongo cache

This commit is contained in:
TheBeastLT
2023-02-26 09:01:37 +01:00
parent d50acf1f28
commit bd00282e64
2 changed files with 5 additions and 5 deletions

View File

@@ -27,10 +27,10 @@ builder.defineStreamHandler((args) => {
return Promise.resolve({ streams: [] }); return Promise.resolve({ streams: [] });
} }
return cacheWrapStream(args.id, () => limiter.schedule(() => streamHandler(args) return limiter.schedule(() => streamHandler(args)
.then(records => records .then(records => records
.sort((a, b) => b.torrent.seeders - a.torrent.seeders || b.torrent.uploadDate - a.torrent.uploadDate) .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 => applyFilters(streams, args.extra))
.then(streams => applySorting(streams, args.extra)) .then(streams => applySorting(streams, args.extra))
.then(streams => applyStaticInfo(streams)) .then(streams => applyStaticInfo(streams))

View File

@@ -10,7 +10,7 @@ const RESOLVED_URL_KEY_PREFIX = `${GLOBAL_KEY_PREFIX}|resolved`;
const STREAM_TTL = process.env.STREAM_TTL || 4 * 60 * 60; // 4 hours const STREAM_TTL = process.env.STREAM_TTL || 4 * 60 * 60; // 4 hours
const STREAM_EMPTY_TTL = process.env.STREAM_EMPTY_TTL || 60; // 1 minute const STREAM_EMPTY_TTL = process.env.STREAM_EMPTY_TTL || 60; // 1 minute
const AVAILABILITY_TTL = 8 * 60 * 60; // 8 hours const AVAILABILITY_TTL = 8 * 60 * 60; // 8 hours
const AVAILABILITY_EMPTY_TTL = 60 * 60; // 1 hours const AVAILABILITY_EMPTY_TTL = 60 * 60; // 1 hour
const MESSAGE_VIDEO_URL_TTL = 60; // 1 minutes const MESSAGE_VIDEO_URL_TTL = 60; // 1 minutes
// When the streams are empty we want to cache it for less time in case of timeouts or failures // When the streams are empty we want to cache it for less time in case of timeouts or failures
@@ -18,7 +18,7 @@ const MONGO_URI = process.env.MONGODB_URI;
const NO_CACHE = process.env.NO_CACHE || false; const NO_CACHE = process.env.NO_CACHE || false;
const memoryCache = initiateMemoryCache(); const memoryCache = initiateMemoryCache();
const remoteCache = initiateRemoteCache(); // const remoteCache = initiateRemoteCache();
function initiateRemoteCache() { function initiateRemoteCache() {
if (NO_CACHE) { if (NO_CACHE) {
@@ -62,7 +62,7 @@ function cacheWrap(cache, key, method, options) {
} }
function cacheWrapStream(id, method) { function cacheWrapStream(id, method) {
return cacheWrap(remoteCache, `${STREAM_KEY_PREFIX}:${id}`, method, { return cacheWrap(memoryCache, `${STREAM_KEY_PREFIX}:${id}`, method, {
ttl: (streams) => streams.length ? STREAM_TTL : STREAM_EMPTY_TTL ttl: (streams) => streams.length ? STREAM_TTL : STREAM_EMPTY_TTL
}); });
} }