MCPcopy
hub / github.com/garrytan/gstack / pruneExpired

Function pruneExpired

browse/src/pty-session-cookie.ts:106–117  ·  view source on GitHub ↗
(now: number)

Source from the content-addressed store, hash-verified

104}
105
106function pruneExpired(now: number): void {
107 let checked = 0;
108 for (const [token, session] of sessions) {
109 if (checked++ >= 20) break;
110 if (session.expiresAt <= now) sessions.delete(token);
111 }
112 while (sessions.size > MAX_SESSIONS) {
113 const first = sessions.keys().next().value;
114 if (!first) break;
115 sessions.delete(first);
116 }
117}
118
119// Test-only reset.
120export function __resetPtySessions(): void {

Callers 2

mintPtySessionTokenFunction · 0.70
validatePtySessionTokenFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected