refactor: async cleanup session
This commit is contained in:
parent
f2a518cff2
commit
93b34dcc85
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user