Handle the intercepted call case

pull/21988/head
Lidi Zheng 5 years ago
parent e0f8fe3254
commit 7a50172cc8
  1. 18
      src/python/grpcio/grpc/experimental/aio/_channel.py

@ -363,9 +363,21 @@ class Channel:
candidate = frame.f_locals.get('self')
if candidate:
if isinstance(candidate, _base_call.Call):
if candidate._cython_call._channel is self._channel:
calls.append(candidate)
call_tasks.append(task)
if hasattr(candidate, '_channel'):
# For intercepted Call object
if candidate._channel is not self._channel:
continue
elif hasattr(candidate, '_cython_call'):
# For normal Call object
if candidate._cython_call._channel is not self._channel:
continue
else:
# Unidentified Call object
raise cygrpc.InternalError(
f'Unrecognized call object: {candidate}')
calls.append(candidate)
call_tasks.append(task)
# If needed, try to wait for them to finish.
# Call objects are not always awaitables.

Loading…
Cancel
Save