fix: remove lamassu login-related filtering

fix: use logger instead of console
This commit is contained in:
Sérgio Salgado 2021-11-16 00:12:19 +00:00
parent b9114b6a33
commit 2ff9ac5bcd
7 changed files with 11 additions and 46 deletions

View file

@ -1,6 +1,7 @@
const { asyncLocalStorage } = require('../../async-storage')
const db = require('../../db')
const { USER_SESSIONS_TABLE_NAME } = require('../../constants')
const logger = require('../../logger')
const schemaCache = {}
@ -11,7 +12,7 @@ const cleanUserSessions = (cleanInterval) => (req, res, next) => {
if (!schema) return next()
if (schema && schemaCache.schema + cleanInterval > now) return next()
console.log('Clearing expired sessions for schema', schema)
logger.debug(`Clearing expired sessions for schema ${schema}`)
return db.none('DELETE FROM $1^ WHERE expire < to_timestamp($2 / 1000.0)', [USER_SESSIONS_TABLE_NAME, now])
.then(() => {
schemaCache.schema = now