From b26f65203e5ab8cf2095a6c451eca03d36f8ad03 Mon Sep 17 00:00:00 2001 From: sharath <29162020+tnfssc@users.noreply.github.com> Date: Mon, 2 Jun 2025 20:42:38 +0000 Subject: [PATCH] fix(run_agent_background): add delay for pending Redis operations before completion logging --- backend/run_agent_background.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/run_agent_background.py b/backend/run_agent_background.py index 5c7ee70c..e957cf9c 100644 --- a/backend/run_agent_background.py +++ b/backend/run_agent_background.py @@ -231,6 +231,9 @@ async def run_agent_background( # Remove the instance-specific active run key await _cleanup_redis_instance_key(agent_run_id) + # Wait for 5 seconds for any pending redis operations to complete + await asyncio.sleep(5) + logger.info(f"Agent run background task fully completed for: {agent_run_id} (Instance: {instance_id}) with final status: {final_status}") async def _cleanup_redis_instance_key(agent_run_id: str):