Merge pull request #7087 from Budibase/logs/invalidations
Adding logging for session invalidation
This commit is contained in:
commit
881ad63a13
|
@ -1,5 +1,6 @@
|
||||||
const redis = require("../redis/init")
|
const redis = require("../redis/init")
|
||||||
const { v4: uuidv4 } = require("uuid")
|
const { v4: uuidv4 } = require("uuid")
|
||||||
|
const { logWarn } = require("../logging")
|
||||||
|
|
||||||
// a week in seconds
|
// a week in seconds
|
||||||
const EXPIRY_SECONDS = 86400 * 7
|
const EXPIRY_SECONDS = 86400 * 7
|
||||||
|
@ -38,6 +39,11 @@ async function invalidateSessions(userId, sessionIds = null) {
|
||||||
for (let session of sessions) {
|
for (let session of sessions) {
|
||||||
promises.push(client.delete(session.key))
|
promises.push(client.delete(session.key))
|
||||||
}
|
}
|
||||||
|
logWarn(
|
||||||
|
`Invalidating sessions for ${userId} - ${sessions
|
||||||
|
.map(session => session.key)
|
||||||
|
.join(", ")}`
|
||||||
|
)
|
||||||
await Promise.all(promises)
|
await Promise.all(promises)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`Error invalidating sessions: ${err}`)
|
console.error(`Error invalidating sessions: ${err}`)
|
||||||
|
|
|
@ -5,3 +5,4 @@ build/
|
||||||
docker-error.log
|
docker-error.log
|
||||||
envoy.yaml
|
envoy.yaml
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
prebuilds/
|
||||||
|
|
Loading…
Reference in New Issue