Skip to content
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

Refactoring core session management #486

Closed
wants to merge 77 commits into from

Conversation

teocns
Copy link
Contributor

@teocns teocns commented Nov 3, 2024

Abstract

The Session module functions as a god object, which complicates working with its varied responsibilities and behaviors. This design has led to significant issues, particularly with threading and synchronization, contributing to problems like the deadlock observed in #477.

Mission

To refactor the session module by:

  1. Breaking down its responsibilities into smaller, more focused components that emphasize separation of concerns.
  2. Guaranteeing thread safety and synchronization.
  3. Streamlining the event publishing mechanism.
  4. Favoring modularity, extensibility, maintainability

Visioned design (Work in Progress)

Session Module Components

  • SessionStruct: A model class that strictly defines the schema for session packets.
  • SessionApi: Acts as the service layer facilitating API communication.
  • Session: Maintains representing a live Session; acts as a manager, with targeted and clearer responsibilities

Thread Management Classes

  • _SessionThread: Implements threading.Thread and exposes an interface Session understands.
  • ChangesObserverThread: Passive listener for Session model changes; publishes to API when notified.
  • EventPublisherThread: Polls from a Queue shared with Session, aggregates payload in a "batch-and-flush" strategy with three triggers: max size, time threshold or empty queue.

...

TO BE CONTINUED

@teocns teocns force-pushed the core-major-refactor branch 5 times, most recently from 908a278 to a7e527f Compare November 12, 2024 16:08
@teocns teocns marked this pull request as draft November 18, 2024 12:37
@areibman areibman changed the title [DO NOT MERGE] Refactoring core session management Refactoring core session management Nov 19, 2024
refactor(session): simplify jwt check in session method
Signed-off-by: Teo <[email protected]>
@teocns teocns force-pushed the core-major-refactor branch from bfca31a to b7dd348 Compare November 29, 2024 18:59
@teocns teocns mentioned this pull request Nov 29, 2024
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had any activity in the last 14 days.

@ please review this PR and make any necessary updates.

If no updates are made within 7 days, this PR will be automatically closed.

@github-actions github-actions bot added the stale label Dec 14, 2024
Copy link
Contributor

This pull request has been automatically closed because it has been stale for 7 days with no activity.

Feel free to reopen this PR if you'd like to continue working on it.

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

Successfully merging this pull request may close these issues.

3 participants