Commit cd6fd140 by sunqi02 Committed by 胡悦

refactor: ActiveSessionService uses db_factory instead of db instance

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent f40e5825
......@@ -5,7 +5,9 @@ import logging
from dataclasses import dataclass
from datetime import datetime
from app.infrastructure.time import china_now
from typing import Optional
from typing import Callable, Optional
from sqlalchemy.orm import Session as SASession
from app.infrastructure.session_store import SessionStore
from app.model.session import Session
......@@ -27,9 +29,9 @@ class ActiveSessionInfo:
class ActiveSessionService:
def __init__(self, store: Optional[SessionStore] = None, db=None) -> None:
def __init__(self, store: Optional[SessionStore] = None, db_factory: Optional[Callable[[], SASession]] = None) -> None:
self.store = store or SessionStore()
self._db = db
self._db_factory = db_factory
def get_or_create_session(
self,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!