diff --git a/dbal/ts/src/core/entities/session/clean-expired.ts b/dbal/ts/src/core/entities/session/clean-expired.ts index 2c0f9f6e3..631809c34 100644 --- a/dbal/ts/src/core/entities/session/clean-expired.ts +++ b/dbal/ts/src/core/entities/session/clean-expired.ts @@ -2,30 +2,30 @@ * @file clean-expired.ts * @description Clean expired sessions operation */ -import type { Result } from '../types'; -import type { InMemoryStore } from '../store/in-memory-store'; +import type { Result } from '../../types' +import type { InMemoryStore } from '../../store/in-memory-store' /** * Clean up expired sessions * @returns Number of sessions removed */ -export async function cleanExpiredSessions(store: InMemoryStore): Promise> { - const now = new Date(); - const expiredIds: string[] = []; +export const cleanExpiredSessions = async (store: InMemoryStore): Promise> => { + const now = new Date() + const expiredIds: string[] = [] for (const [id, session] of store.sessions) { - if (session.expiresAt < now) { - expiredIds.push(id); + if (session.expiresAt <= now) { + expiredIds.push(id) } } for (const id of expiredIds) { - const session = store.sessions.get(id); + const session = store.sessions.get(id) if (session) { - store.sessionTokens.delete(session.token); - store.sessions.delete(id); + store.sessionTokens.delete(session.token) + store.sessions.delete(id) } } - return { success: true, data: expiredIds.length }; + return { success: true, data: expiredIds.length } }