feat(server/session): clean up expired sessions

This commit is contained in:
Elian Doran 2025-05-16 23:44:41 +03:00
parent 43ab13e126
commit 15a513d7cd
No known key found for this signature in database

View File

@ -62,4 +62,11 @@ const sessionParser = session({
store: new SQLiteSessionStore()
});
setInterval(() => {
// Clean up expired sesions.
const now = Date.now();
const result = sql.execute(/*sql*/`DELETE FROM sessions WHERE expires < ?`, now);
console.log("Cleaning up expired sessions: ", result.changes);
}, 60 * 60 * 1000);
export default sessionParser;