mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
fix(session): serialize direct persistence flushes
This commit is contained in:
parent
0b422559f3
commit
69fd846ef8
2 changed files with 64 additions and 0 deletions
12
run_agent.py
12
run_agent.py
|
|
@ -1765,6 +1765,18 @@ class AIAgent:
|
|||
return repair_message_sequence(self, messages)
|
||||
|
||||
def _flush_messages_to_session_db(self, messages: List[Dict], conversation_history: List[Dict] = None):
|
||||
"""Serialize direct and turn-boundary session flushes per agent."""
|
||||
persist_lock = getattr(self, "_session_persist_lock", None)
|
||||
if persist_lock is None:
|
||||
return self._flush_messages_to_session_db_unlocked(messages, conversation_history)
|
||||
with persist_lock:
|
||||
return self._flush_messages_to_session_db_unlocked(messages, conversation_history)
|
||||
|
||||
def _flush_messages_to_session_db_unlocked(
|
||||
self,
|
||||
messages: List[Dict],
|
||||
conversation_history: List[Dict] = None,
|
||||
):
|
||||
"""Persist any un-flushed messages to the SQLite session store.
|
||||
|
||||
Deduplicates via an intrinsic ``_DB_PERSISTED_MARKER`` stamped on each
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue