From 7b67f05bbffbc34a8a43ea6a63762f3bfe2e427d Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 16 May 2024 22:59:40 +0600 Subject: [PATCH] stream/manage: fix stream lifespan so that stream lifespan isn't 90 ms --- src/modules/stream/manage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/stream/manage.js b/src/modules/stream/manage.js index e36932c5..6c9e9d3c 100644 --- a/src/modules/stream/manage.js +++ b/src/modules/stream/manage.js @@ -12,7 +12,7 @@ const freebind = env.freebindCIDR && await import('freebind').catch(() => {}); const M3U_SERVICES = ['dailymotion', 'vimeo', 'rutube']; const streamCache = new NodeCache({ - stdTTL: env.streamLifespan/1000, + stdTTL: env.streamLifespan, checkperiod: 10, deleteOnExpire: true }) @@ -28,7 +28,7 @@ export function createStream(obj) { const streamID = nanoid(), iv = randomBytes(16).toString('base64url'), secret = randomBytes(32).toString('base64url'), - exp = new Date().getTime() + env.streamLifespan, + exp = new Date().getTime() + env.streamLifespan * 1000, hmac = generateHmac(`${streamID},${exp},${iv},${secret}`, hmacSalt), streamData = { exp: exp,