Address comments

pull/23280/head
Lidi Zheng 5 years ago
parent 14d499a50f
commit b9088ee9dd
  1. 8
      doc/python/sphinx/grpc_asyncio.rst
  2. 5
      src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi

@ -24,12 +24,8 @@ gRPC Async API objects may only be used on the thread on which they were
created. AsyncIO doesn't provide thread safety for most of its APIs. created. AsyncIO doesn't provide thread safety for most of its APIs.
Enable AsyncIO in gRPC Blocking Code in AsyncIO
---------------------- ------------------------
Enable AsyncIO in gRPC Python is automatic when instantiating gRPC AsyncIO
objects (e.g., channels and servers). No additional function invocation is
required.
Making blocking function calls in coroutines or in the thread running event Making blocking function calls in coroutines or in the thread running event
loop will block the event loop, potentially starving all RPCs in the process. loop will block the event loop, potentially starving all RPCs in the process.

@ -169,7 +169,7 @@ async def generator_to_async_generator(object gen, object loop, object thread_po
await future await future
if PY_MAJOR_VERSION >=3 and PY_MINOR_VERSION >=7: if PY_MAJOR_VERSION >= 3 and PY_MINOR_VERSION >= 7:
def get_working_loop(): def get_working_loop():
"""Returns a running event loop.""" """Returns a running event loop."""
return asyncio.get_running_loop() return asyncio.get_running_loop()
@ -185,4 +185,5 @@ else:
if loop.is_running(): if loop.is_running():
return loop return loop
else: else:
raise RuntimeError('no running event loop') raise RuntimeError('No running event loop detected. This function '
+ 'must be called from inside of a running event loop.')

Loading…
Cancel
Save