+81
−0
+10
−0
Loading
RequestEvent creates a session row for every request without a valid
sessionid cookie, but that Set-Cookie never reaches the browser (the
cookie-banner logic depends on the session not existing until consent),
so each anonymous request left one dead row behind. Nothing ever
deleted sessions.
createSession() now triggers _purgeStale() at most every 10 minutes:
- data-less sessions older than 1 h (consent and login always write
session_data, so these were never handed out)
- sessions older than 45 days incl. their session_data (cookie
max-age is 3600000 s and never refreshed)
Adds indexes on session_data(sessionid) and session(created) so the
anti-join and range scan don't degrade to full nested scans.
Tested against the real Session class on SQLite and PostgreSQL 17.
Co-Authored-By:
Claude Opus 5.5 <noreply@anthropic.com>