diff --git a/api/src/controllers/internal/Execution.ts b/api/src/controllers/internal/Execution.ts index d97d1be..c488d95 100644 --- a/api/src/controllers/internal/Execution.ts +++ b/api/src/controllers/internal/Execution.ts @@ -38,6 +38,7 @@ export class ExecutionController { const session = await sessionController.getSession() console.log('using session', session.id) session.inUse = true + session.consumed = true const logPath = path.join(session.path, 'log.log') diff --git a/api/src/controllers/internal/Session.ts b/api/src/controllers/internal/Session.ts index 21ca22c..525a072 100644 --- a/api/src/controllers/internal/Session.ts +++ b/api/src/controllers/internal/Session.ts @@ -34,7 +34,7 @@ export class SessionController { } private getReadySessions = (): Session[] => - this.sessions.filter((sess: Session) => sess.ready) + this.sessions.filter((sess: Session) => sess.ready && !sess.consumed) private async createSession(): Promise { const sessionId = generateUniqueFileName(generateTimestamp()) @@ -52,6 +52,7 @@ export class SessionController { id: sessionId, ready: false, inUse: false, + consumed: false, completed: false, creationTimeStamp, deathTimeStamp, diff --git a/api/src/types/Session.ts b/api/src/types/Session.ts index cf3e490..0507a6d 100644 --- a/api/src/types/Session.ts +++ b/api/src/types/Session.ts @@ -5,6 +5,7 @@ export interface Session { deathTimeStamp: string path: string inUse: boolean + consumed: boolean completed: boolean crashed?: string }