mirror of
https://github.com/sasjs/server.git
synced 2026-01-08 23:10:05 +00:00
chore: clean up
This commit is contained in:
@@ -36,7 +36,6 @@ export class ExecutionController {
|
|||||||
const sessionController = getSessionController()
|
const sessionController = getSessionController()
|
||||||
|
|
||||||
const session = await sessionController.getSession()
|
const session = await sessionController.getSession()
|
||||||
console.log('using session', session.id)
|
|
||||||
session.inUse = true
|
session.inUse = true
|
||||||
session.consumed = true
|
session.consumed = true
|
||||||
|
|
||||||
@@ -99,7 +98,6 @@ ${program}`
|
|||||||
// (which can mean SAS trying to run a partial program, or
|
// (which can mean SAS trying to run a partial program, or
|
||||||
// failing due to file lock) we first create the file THEN
|
// failing due to file lock) we first create the file THEN
|
||||||
// we rename it.
|
// we rename it.
|
||||||
console.log('executing session', session.id)
|
|
||||||
await createFile(codePath + '.bkp', program)
|
await createFile(codePath + '.bkp', program)
|
||||||
await moveFile(codePath + '.bkp', codePath)
|
await moveFile(codePath + '.bkp', codePath)
|
||||||
|
|
||||||
@@ -107,7 +105,6 @@ ${program}`
|
|||||||
while (!session.completed) {
|
while (!session.completed) {
|
||||||
await delay(50)
|
await delay(50)
|
||||||
}
|
}
|
||||||
console.log('completed session', session.id)
|
|
||||||
|
|
||||||
const log =
|
const log =
|
||||||
((await fileExists(logPath)) ? await readFile(logPath) : '') +
|
((await fileExists(logPath)) ? await readFile(logPath) : '') +
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ const execFilePromise = promisify(execFile)
|
|||||||
export class SessionController {
|
export class SessionController {
|
||||||
private sessions: Session[] = []
|
private sessions: Session[] = []
|
||||||
|
|
||||||
|
private getReadySessions = (): Session[] =>
|
||||||
|
this.sessions.filter((sess: Session) => sess.ready && !sess.consumed)
|
||||||
|
|
||||||
public async getSession() {
|
public async getSession() {
|
||||||
const readySessions = this.getReadySessions()
|
const readySessions = this.getReadySessions()
|
||||||
|
|
||||||
@@ -33,9 +36,6 @@ export class SessionController {
|
|||||||
return session
|
return session
|
||||||
}
|
}
|
||||||
|
|
||||||
private getReadySessions = (): Session[] =>
|
|
||||||
this.sessions.filter((sess: Session) => sess.ready && !sess.consumed)
|
|
||||||
|
|
||||||
private async createSession(): Promise<Session> {
|
private async createSession(): Promise<Session> {
|
||||||
const sessionId = generateUniqueFileName(generateTimestamp())
|
const sessionId = generateUniqueFileName(generateTimestamp())
|
||||||
console.log('creating session', sessionId)
|
console.log('creating session', sessionId)
|
||||||
@@ -108,8 +108,6 @@ export class SessionController {
|
|||||||
// the autoexec deletes the code.sas file
|
// the autoexec deletes the code.sas file
|
||||||
await this.waitForSession(session)
|
await this.waitForSession(session)
|
||||||
|
|
||||||
console.log('session is ready', sessionId)
|
|
||||||
|
|
||||||
return session
|
return session
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user