refactor: async cleanup session

This commit is contained in:
qwqVictor 2024-05-04 15:36:42 +08:00
parent f2a518cff2
commit 93b34dcc85

View File

@ -55,13 +55,13 @@ class SessionPool {
/** /**
* Cleans up expired sessions from the pool. * Cleans up expired sessions from the pool.
*/ */
cleanupSessions() { async cleanupSessions() {
const now = Date.now(); const now = Date.now();
for (const [key, session] of this.sessions) { for (const [key, session] of this.sessions) {
if (session.expiration <= now) { if (session.expiration <= now) {
this.sessions.delete(key); this.sessions.delete(key);
session.off(session.value) await session.off(session.value)
} }
} }
} }