File tree Expand file tree Collapse file tree
src/a2a/server/request_handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -449,9 +449,14 @@ async def _cleanup_producer(
449449 """Cleans up the agent execution task and queue manager entry."""
450450 try :
451451 await producer_task
452- except (Exception , asyncio .CancelledError ):
453- # We don't want to stop cleanup if the producer task failed or was cancelled
454- pass
452+ except asyncio .CancelledError :
453+ # The producer task was cancelled, which is an expected outcome in some scenarios.
454+ # We don't want to stop cleanup in this case.
455+ logger .debug ('Producer task %s was cancelled during cleanup' , task_id )
456+ except Exception :
457+ # Log other exceptions from the producer task to avoid losing error information,
458+ # but continue with the cleanup process.
459+ logger .exception ('Producer task %s failed during cleanup' , task_id )
455460 await self ._queue_manager .close (task_id )
456461 async with self ._running_agents_lock :
457462 self ._running_agents .pop (task_id , None )
You can’t perform that action at this time.
0 commit comments