From c8e213885617e853d85abb04809528e4cc88ec46 Mon Sep 17 00:00:00 2001 From: TheBeastLT Date: Wed, 11 Mar 2020 19:12:22 +0100 Subject: [PATCH] updates addon cache times --- addon/addon.js | 8 ++++---- addon/lib/cache.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addon/addon.js b/addon/addon.js index 51e2903..928fc1c 100644 --- a/addon/addon.js +++ b/addon/addon.js @@ -4,10 +4,10 @@ const { toStreamInfo } = require('./lib/streamInfo'); const { cacheWrapStream } = require('./lib/cache'); const repository = require('./lib/repository'); -const CACHE_MAX_AGE = process.env.CACHE_MAX_AGE || 24 * 60; // 24 hours in seconds -const CACHE_MAX_AGE_EMPTY = 4 * 60; // 4 hours in seconds -const STALE_REVALIDATE_AGE = 4 * 60; // 4 hours -const STALE_ERROR_AGE = 7 * 24 * 60; // 7 days +const CACHE_MAX_AGE = process.env.CACHE_MAX_AGE || 4 * 60 * 60; // 4 hours in seconds +const CACHE_MAX_AGE_EMPTY = 30 * 60; // 30 minutes +const STALE_REVALIDATE_AGE = 4 * 60 * 60; // 4 hours +const STALE_ERROR_AGE = 7 * 24 * 60 * 60; // 7 days const builder = new addonBuilder({ id: 'com.stremio.torrentio.addon', diff --git a/addon/lib/cache.js b/addon/lib/cache.js index 3fb1113..80502e4 100644 --- a/addon/lib/cache.js +++ b/addon/lib/cache.js @@ -4,7 +4,7 @@ const mangodbStore = require('cache-manager-mongodb'); const GLOBAL_KEY_PREFIX = 'torrentio-addon'; const STREAM_KEY_PREFIX = `${GLOBAL_KEY_PREFIX}|stream`; -const STREAM_TTL = process.env.STREAM_TTL || 24 * 60 * 60; // 24 hours +const STREAM_TTL = process.env.STREAM_TTL || 4 * 60 * 60; // 4 hours const STREAM_EMPTY_TTL = process.env.STREAM_EMPTY_TTL || 30 * 60; // 30 minutes // When the streams are empty we want to cache it for less time in case of timeouts or failures