stream/manage: fix stream lifespan

so that stream lifespan isn't 90 ms
This commit is contained in:
wukko 2024-05-16 22:59:40 +06:00
parent ee1e899b39
commit 7b67f05bbf
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -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,