Skip to content

Commit

Permalink
chore(lint): fixed linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury4GL committed Oct 29, 2024
1 parent 76750e8 commit 3053c68
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 25 deletions.
46 changes: 25 additions & 21 deletions api/src/controllers/internal/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,33 +189,37 @@ ${autoExecContent}`
}

private scheduleSessionDestroy(session: Session) {
setTimeout(async () => {
if (session.inUse) {
// adding 10 more minutes
const newDeathTimeStamp =
parseInt(session.deathTimeStamp) + 10 * 60 * 1000
session.deathTimeStamp = newDeathTimeStamp.toString()

this.scheduleSessionDestroy(session)
} else {
const { expiresAfterMins } = session

// delay session destroy if expiresAfterMins present
if (expiresAfterMins && !expiresAfterMins.used) {
// calculate session death time using expiresAfterMins
setTimeout(
async () => {
if (session.inUse) {
// adding 10 more minutes
const newDeathTimeStamp =
parseInt(session.deathTimeStamp) + expiresAfterMins.mins * 60 * 1000
parseInt(session.deathTimeStamp) + 10 * 60 * 1000
session.deathTimeStamp = newDeathTimeStamp.toString()

// set expiresAfterMins to true to avoid using it again
session.expiresAfterMins!.used = true

this.scheduleSessionDestroy(session)
} else {
await this.deleteSession(session)
const { expiresAfterMins } = session

// delay session destroy if expiresAfterMins present
if (expiresAfterMins && !expiresAfterMins.used) {
// calculate session death time using expiresAfterMins
const newDeathTimeStamp =
parseInt(session.deathTimeStamp) +
expiresAfterMins.mins * 60 * 1000
session.deathTimeStamp = newDeathTimeStamp.toString()

// set expiresAfterMins to true to avoid using it again
session.expiresAfterMins!.used = true

this.scheduleSessionDestroy(session)
} else {
await this.deleteSession(session)
}
}
}
}, parseInt(session.deathTimeStamp) - new Date().getTime() - 100)
},
parseInt(session.deathTimeStamp) - new Date().getTime() - 100
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion api/src/controllers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const getUser = async (
username: user.username,
isActive: user.isActive,
isAdmin: user.isAdmin,
autoExec: getAutoExec ? user.autoExec ?? '' : undefined,
autoExec: getAutoExec ? (user.autoExec ?? '') : undefined,
groups: user.groups
}
}
Expand Down
5 changes: 2 additions & 3 deletions api/src/utils/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export const generateFileUploadSasCode = async (
let fileCount = 0
const uploadedFiles: UploadedFiles[] = []

const sasSessionFolderList: string[] = await listFilesInFolder(
sasSessionFolder
)
const sasSessionFolderList: string[] =
await listFilesInFolder(sasSessionFolder)
sasSessionFolderList.forEach((fileName) => {
let fileCountString = fileCount < 100 ? '0' + fileCount : fileCount
fileCountString = fileCount < 10 ? '00' + fileCount : fileCount
Expand Down

0 comments on commit 3053c68

Please sign in to comment.