-
Notifications
You must be signed in to change notification settings - Fork 4
Session management #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session management #102
Conversation
- remove logged_on attribute from user schema, add a concurrency limit - add session schema, one user to many sessions - add a SessionSupervisor to hook into the server lifecycle and do cleanup - add a SessionManager responsible for manipulating the session table - fix repocase to ensure the database doesn't shutdown till the test completes - update test_helper
# Conflicts: # apps/server/lib/prodigy/server/service/messaging.ex
Session is now a persistent record of when users sessions begin and end (and thus which are presently active), and Context was chosen to represent the ephemeral details that are necessary to the operation of the service during a single user connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors session management from a simple boolean flag to a proper database table with support for concurrent sessions.
- Replaced user-level
logged_onboolean with a dedicated session table - Added configurable concurrency limits per user (default: 1, 0 for unlimited)
- Renamed
SessiontoContextto better reflect ephemeral connection state
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/server/lib/prodigy/server/session_manager.ex | New module for managing user sessions with concurrency control |
| apps/server/lib/prodigy/server/session_cleanup.ex | New GenServer for cleaning up sessions on shutdown |
| apps/core/priv/repo/migrations/20250908221355_create_sessions.exs | Database migration creating session table and removing logged_on field |
| apps/core/lib/prodigy/core/data/session.ex | New Session schema for persistent session records |
| apps/core/lib/prodigy/core/data/user.ex | Updated User schema to include concurrency_limit and sessions relationship |
| apps/server/lib/prodigy/server/context.ex | Renamed from Session to Context for ephemeral connection state |
| apps/server/lib/prodigy/server/service/logon.ex | Updated to use SessionManager for concurrency control |
| apps/server/lib/prodigy/server/service/logoff.ex | Updated to close sessions via SessionManager |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Refactor sessions into a database table, support logon concurrency
Prodigy.Core.Data.Session, and the formerProdigy.Server.Sessionhas been renamedProdigy.Server.Context, which is used to store ephemeral state related to connection while that connection is active.