diff --git a/src/python/grpcio/grpc/experimental/aio/_call.py b/src/python/grpcio/grpc/experimental/aio/_call.py index 8fafcde2a1b..be4887d239c 100644 --- a/src/python/grpcio/grpc/experimental/aio/_call.py +++ b/src/python/grpcio/grpc/experimental/aio/_call.py @@ -400,11 +400,11 @@ class _StreamRequestMixin(Call): if inspect.isasyncgen(request_iterator): async for request in request_iterator: await self._write(request) - await self._done_writing() else: for request in request_iterator: await self._write(request) - await self._done_writing() + + await self._done_writing() except AioRpcError as rpc_error: # Rpc status should be exposed through other API. Exceptions raised # within this Task won't be retrieved by another coroutine. It's