Skip to content

Commit

Permalink
Fix error that prevents continuing old threads that were migrated.
Browse files Browse the repository at this point in the history
Co-authored-by: Nuno Campos <[email protected]>
  • Loading branch information
bakar-io and nfcampos authored Mar 29, 2024
1 parent 5560f3c commit b00ddbd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/redis_to_postgres/migrate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ async def migrate_checkpoints() -> None:
config = {"configurable": {"user_id": user_id, "thread_id": thread_id}}
checkpoint = redis_checkpoint.get(config)
if checkpoint:
if checkpoint.get("channel_values", {}).get("__root__"):
checkpoint["channel_values"]["__root__"] = [
msg.__class__(**msg.__dict__.items())
for msg in checkpoint["channel_values"]["__root__"]
]
await postgres_checkpoint.aput(config, checkpoint)
logger.info(
f"Migrated checkpoint for thread {thread_id} for user {user_id}."
Expand Down

0 comments on commit b00ddbd

Please sign in to comment.