仅在会话唯一或旧会话已过期时写入会话池。
(self, session: GuestSession)
| 347 | return self._should_retire_session(session) |
| 348 | |
| 349 | def _store_session(self, session: GuestSession) -> bool: |
| 350 | """仅在会话唯一或旧会话已过期时写入会话池。""" |
| 351 | with self._lock: |
| 352 | existing = self._sessions.get(session.user_id) |
| 353 | if existing and not self._can_replace_session(existing): |
| 354 | return False |
| 355 | self._sessions[session.user_id] = session |
| 356 | return True |
| 357 | |
| 358 | def _log_duplicate_sessions(self, action: str, user_ids: List[str]): |
| 359 | """记录重复会话,避免补池时静默覆盖。""" |
no test coverage detected