Make a proper shallow copy of onging calls set

pull/21921/head
Lidi Zheng 5 years ago
parent eeccff4e74
commit c7095d6854
  1. 5
      src/python/grpcio/grpc/experimental/aio/_channel.py

@ -395,9 +395,10 @@ class Channel:
# A new set is created acting as a shallow copy because
# when cancellation happens the calls are automatically
# removed from the originally set.
calls = WeakSet(data=self._ongoing_calls.calls)
calls = frozenset(self._ongoing_calls.calls)
for call in calls:
call.cancel()
if call is not None:
call.cancel()
self._channel.close()

Loading…
Cancel
Save