diegosouzapw/OmniRoute · error
[SESSION_AFFINITY] Periodic cleanup failed:
Error message
[SESSION_AFFINITY] Periodic cleanup failed:
What it means
The interval-driven cleanup of stale session-account affinity records threw on one tick. The cleanup for that tick is abandoned; expired affinity entries linger (potentially pinning sessions to stale connections) until a subsequent tick succeeds.
Solutions
- Check the logged error for database availability/locks
- Verify the key_value table is healthy
- Let the next interval retry, or restart to force startup cleanup
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/lib/db/sessionAccountAffinity.ts:202 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/01055731c5694bd2.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/db/sessionAccountAffinity.ts:202
tx();
return deleted;
}
export function startSessionAccountAffinityCleanup(): void {
if (cleanupTimer) return;
try {
cleanupStaleSessionAccountAffinities();
} catch (error) {
console.warn("[SESSION_AFFINITY] Startup cleanup failed:", error);
}
cleanupTimer = setInterval(() => {
try {
cleanupStaleSessionAccountAffinities();
} catch (error) {
console.warn("[SESSION_AFFINITY] Periodic cleanup failed:", error);
}
}, CLEANUP_INTERVAL_MS);
if (typeof cleanupTimer === "object" && "unref" in cleanupTimer) cleanupTimer.unref?.();
}
export function stopSessionAccountAffinityCleanupForTests(): void {
if (!cleanupTimer) return;
clearInterval(cleanupTimer);
cleanupTimer = null;
}
View on GitHub (pinned to a179ffed5b)