fix: periodic session checkpoint during streaming — v0.50.132 (#810)

Closes #765. Supersedes #809 (@bergeouss). Co-authored-by: bergeouss <bergeouss@users.noreply.github.com>
This commit is contained in:
nesquena-hermes
2026-04-21 12:07:44 -07:00
committed by GitHub
parent 081c4208d9
commit f6e1612c7e
4 changed files with 356 additions and 2 deletions

View File

@@ -121,14 +121,15 @@ class Session:
def path(self):
return SESSION_DIR / f'{self.session_id}.json'
def save(self, touch_updated_at: bool = True) -> None:
def save(self, touch_updated_at: bool = True, skip_index: bool = False) -> None:
if touch_updated_at:
self.updated_at = time.time()
self.path.write_text(
json.dumps(self.__dict__, ensure_ascii=False, indent=2),
encoding='utf-8',
)
_write_session_index(updates=[self])
if not skip_index:
_write_session_index(updates=[self])
@classmethod
def load(cls, sid):