mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 00:00:20 +00:00
fix: evict expired SESSION_MANAGER_CACHE entries on TTL miss
isSessionManagerCached() checks TTL before returning stale hits but never deletes expired entries from the Map. They accumulate indefinitely over the lifetime of a long-running gateway. Delete the expired entry when the TTL check fails so the Map stays bounded to active sessions. Closes #51820
This commit is contained in:
committed by
Peter Steinberger
parent
055f62e43e
commit
30090e4895
@@ -42,7 +42,11 @@ function isSessionManagerCached(sessionFile: string): boolean {
|
||||
}
|
||||
const now = Date.now();
|
||||
const ttl = getSessionManagerTtl();
|
||||
return now - entry.loadedAt <= ttl;
|
||||
if (now - entry.loadedAt > ttl) {
|
||||
SESSION_MANAGER_CACHE.delete(sessionFile);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function prewarmSessionFile(sessionFile: string): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user