[thread-store] separate history materialization

This commit is contained in:
Michael Zeng
2026-07-06 15:35:17 -07:00
parent 1a683e0916
commit bbd91ab14e
2 changed files with 10 additions and 3 deletions
@@ -168,6 +168,14 @@ pub(super) async fn append_items(
pub(super) async fn persist_thread(
store: &LocalThreadStore,
thread_id: ThreadId,
) -> ThreadStoreResult<()> {
persist_history(store, thread_id).await?;
store.flush_pending_metadata_update(thread_id).await
}
pub(super) async fn persist_history(
store: &LocalThreadStore,
thread_id: ThreadId,
) -> ThreadStoreResult<()> {
store
.live_recorder(thread_id)
@@ -175,8 +183,7 @@ pub(super) async fn persist_thread(
.persist()
.await
.map_err(thread_store_io_error)?;
sync_materialized_rollout_path(store, thread_id).await?;
store.flush_pending_metadata_update(thread_id).await
sync_materialized_rollout_path(store, thread_id).await
}
pub(super) async fn flush_thread(
@@ -83,7 +83,7 @@ pub(super) async fn update_thread_metadata(
}
if live_writer::rollout_path(store, thread_id).await.is_ok() {
live_writer::persist_thread(store, thread_id).await?;
live_writer::persist_history(store, thread_id).await?;
}
let mut resolved_rollout_path =
resolve_rollout_path(store, thread_id, params.include_archived).await?;