fix: 🐛 positive max age calculation
This commit is contained in:
parent
a1844176bb
commit
e2c8313aa3
|
@ -11,7 +11,7 @@ export class SessionStore {
|
|||
|
||||
static get maxAge() {
|
||||
const halfHour = 30 * 60 * 1_000
|
||||
return Date.now() - halfHour
|
||||
return Date.now() + halfHour
|
||||
}
|
||||
static createSession(): Session {
|
||||
return new Session(this.#store)
|
||||
|
@ -19,13 +19,15 @@ export class SessionStore {
|
|||
|
||||
static getSession(uuid: string): Session | undefined {
|
||||
// Check session validity
|
||||
const halfHour = 30 * 60 * 1_000
|
||||
const maxOld = Date.now() - halfHour
|
||||
const session = this.#store.get(uuid)
|
||||
|
||||
if (session === undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (session.timestamp < this.maxAge) {
|
||||
if (session.timestamp < maxOld) {
|
||||
session.destroy()
|
||||
return undefined
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue