mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-11-01 01:24:45 +03:00
feat: refactor ChatSessionManager to be application-specific and integrate httpx2 for websocket transport
This commit is contained in:
@@ -13,7 +13,6 @@ from uuid import UUID, uuid4
|
||||
import attrs
|
||||
|
||||
from app.schemas.chat import ChatMessage
|
||||
from app.utils.singleton import SingletonMetaNoArgs
|
||||
|
||||
|
||||
@attrs.define(slots=True)
|
||||
@@ -28,11 +27,11 @@ class ChatSession:
|
||||
return list(self.messages)
|
||||
|
||||
|
||||
class ChatSessionManager(metaclass=SingletonMetaNoArgs):
|
||||
class ChatSessionManager:
|
||||
"""Tracks active chat sessions keyed by their opaque session id.
|
||||
|
||||
Implemented as a singleton to ensure exactly one instance per application,
|
||||
maintaining a consistent registry of all active websocket chat sessions.
|
||||
Each application lifespan owns its own manager, maintaining a consistent
|
||||
registry of active websocket chat sessions for that application.
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user