Skip to content

Conversation

@sigfawn
Copy link

@sigfawn sigfawn commented Jan 2, 2026

This PR fixes a memory leak in auth.service.ts where expired sessions were never removed from the activeSessions map.

1. Automatic Session Cleanup

  • Problem: The activeSessions map grew indefinitely because cleanupExpiredSessions() was never called automatically.
  • Fix: Added a background interval (every 5 minutes) to remove expired sessions.
  • Mechanism: Uses setInterval(...).unref() to ensure the cleanup process runs in the background without blocking the Node.js process from exiting (crucial for CLI tools and tests).

Result: Stable memory usage for long-running authentication services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant