chore: server code formatting
This commit is contained in:
parent
aedabcbdee
commit
68517170e2
234 changed files with 9824 additions and 6195 deletions
|
|
@ -4,13 +4,17 @@ const logger = require('../../logger')
|
|||
|
||||
let schemaCache = Date.now()
|
||||
|
||||
const cleanUserSessions = (cleanInterval) => (req, res, next) => {
|
||||
const cleanUserSessions = cleanInterval => (req, res, next) => {
|
||||
const now = Date.now()
|
||||
|
||||
if (schemaCache + cleanInterval > now) return next()
|
||||
|
||||
logger.debug(`Clearing expired sessions for schema 'public'`)
|
||||
return db.none('DELETE FROM $1^ WHERE expire < to_timestamp($2 / 1000.0)', [USER_SESSIONS_TABLE_NAME, now])
|
||||
return db
|
||||
.none('DELETE FROM $1^ WHERE expire < to_timestamp($2 / 1000.0)', [
|
||||
USER_SESSIONS_TABLE_NAME,
|
||||
now,
|
||||
])
|
||||
.then(() => {
|
||||
schemaCache = now
|
||||
return next()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue