Skip to content

Commit

Permalink
Merge pull request #111 from khushaljethava/master
Browse files Browse the repository at this point in the history
added error handling
  • Loading branch information
prateeksachan authored Jan 27, 2025
2 parents d2f04bc + 60f973f commit 1e70643
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions local_setup/quickstart_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ async def get_all_agents():

if not agent_keys:
return {"agents": []}


agents_data = await asyncio.gather(*(redis_client.get(key) for key in agent_keys))
agents_data = []
for key in agent_keys:
try:
data = await redis_client.get(key)
agents_data.append(data)
except Exception as e:
logger.error(f"An error occurred with key {key}: {e}")


agents = [{ "agent_id": key, "data": json.loads(data) } for key, data in zip(agent_keys, agents_data) if data]
Expand Down

0 comments on commit 1e70643

Please sign in to comment.