Skip to content

Commit 39307f1

Browse files
authored
fix: consume_all doesn't catch asyncio.TimeoutError in python 3.10 (#216)
Starting from 3.11, `asyncio.TimeoutError` is a built-in alias https://docs.python.org/3.11/library/asyncio-exceptions.html
1 parent a0bf13b commit 39307f1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/a2a/server/events/event_consumer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ async def consume_all(self) -> AsyncGenerator[Event]:
130130
except TimeoutError:
131131
# continue polling until there is a final event
132132
continue
133+
except asyncio.TimeoutError:
134+
# This class was made an alias of build-in TimeoutError after 3.11
135+
continue
133136
except QueueClosed:
134137
# Confirm that the queue is closed, e.g. we aren't on
135138
# python 3.12 and get a queue empty error on an open queue

0 commit comments

Comments
 (0)