Skip to content

Commit 7db2adf

Browse files
committed
Change comment
1 parent 8f66f2a commit 7db2adf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/a2a/server/request_handlers/request_handler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ async def async_gen_wrapper(
241241
) -> Any:
242242
if params is not None:
243243
validate_proto_required_fields(params)
244-
# Explicitly close the inner async generator in a finally block
245-
# so that its cleanup (except/finally) runs deterministically
246-
# during aclose(). On Python < 3.13, async-for does NOT call
247-
# aclose() on the iterator when an exception (e.g. GeneratorExit)
248-
# propagates through the loop body, leaving cleanup to the GC.
244+
# Ensure the inner async generator is closed explicitly;
245+
# bare async-for does not call aclose() on GeneratorExit,
246+
# which on Python 3.12+ prevents the except/finally blocks
247+
# in on_message_send_stream from running on client disconnect
248+
# (background_consume and cleanup_producer tasks are never created).
249249
inner = method(self, params, context, *args, **kwargs)
250250
try:
251251
async for item in inner:

0 commit comments

Comments
 (0)