From 23db7e7b7df2f22bbf7ce16865f83091624d8047 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Thu, 7 Apr 2022 18:48:22 +0500 Subject: [PATCH] fix: session death time has to be a valid string number --- api/src/controllers/internal/Session.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/src/controllers/internal/Session.ts b/api/src/controllers/internal/Session.ts index 332ffd3..e26d0c7 100644 --- a/api/src/controllers/internal/Session.ts +++ b/api/src/controllers/internal/Session.ts @@ -12,8 +12,7 @@ import { createFile, fileExists, generateTimestamp, - readFile, - moveFile + readFile } from '@sasjs/utils' const execFilePromise = promisify(execFile) @@ -41,6 +40,7 @@ export class SessionController { const sessionFolder = path.join(getTmpSessionsFolderPath(), sessionId) const creationTimeStamp = sessionId.split('-').pop() as string + // death time of session is 15 mins from creation const deathTimeStamp = ( parseInt(creationTimeStamp) + 15 * 60 * 1000 - @@ -140,7 +140,9 @@ ${autoExecContent}` private scheduleSessionDestroy(session: Session) { setTimeout(async () => { if (session.inUse) { - session.deathTimeStamp = session.deathTimeStamp + 1000 * 10 + // adding 10 more minutes + const newDeathTimeStamp = parseInt(session.deathTimeStamp) + 10 * 1000 + session.deathTimeStamp = newDeathTimeStamp.toString() this.scheduleSessionDestroy(session) } else {