MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / _store_session

Method _store_session

app/utils/guest_session_pool.py:349–356  ·  view source on GitHub ↗

仅在会话唯一或旧会话已过期时写入会话池。

(self, session: GuestSession)

Source from the content-addressed store, hash-verified

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 """记录重复会话,避免补池时静默覆盖。"""

Callers 3

initializeMethod · 0.95
acquireMethod · 0.95

Calls 1

_can_replace_sessionMethod · 0.95

Tested by

no test coverage detected