catch block in invalidate sessions

This commit is contained in:
Martin McKeaveney 2022-05-24 22:57:32 +01:00
parent bf0ca9784b
commit 50c6ad9630
1 changed files with 24 additions and 20 deletions

View File

@ -15,6 +15,7 @@ function makeSessionID(userId, sessionId) {
} }
async function invalidateSessions(userId, sessionIds = null) { async function invalidateSessions(userId, sessionIds = null) {
try {
let sessions = [] let sessions = []
// If no sessionIds, get all the sessions for the user // If no sessionIds, get all the sessions for the user
@ -38,6 +39,9 @@ async function invalidateSessions(userId, sessionIds = null) {
promises.push(client.delete(session.key)) promises.push(client.delete(session.key))
} }
await Promise.all(promises) await Promise.all(promises)
} catch (err) {
console.error(`Error invalidating sessions: ${err}`)
}
} }
exports.createASession = async (userId, session) => { exports.createASession = async (userId, session) => {