diff options
author | Nathaniel Manista <nathaniel@google.com> | 2015-08-28 15:48:23 +0000 |
---|---|---|
committer | Nathaniel Manista <nathaniel@google.com> | 2015-08-28 15:48:23 +0000 |
commit | 4b41ba249df4f290b3551b82b6004a0ce77bf2cf (patch) | |
tree | 394644ad13681c5804314d2b032ec5f1fd7645cf /src | |
parent | 400e0cdd321fbec7311d58d9e407c2426490eb69 (diff) |
Two fixes in grpc.framework.core._end
(1) Call "cancel" on each future, not on the list of futures.
(2) If and when futures mature their actions should simply abort all
outstanding operations and cancel any other futures. They should not
shut down the _End's internal thread pool; only the termination action
of the last operation to terminate should shut down the pool (in the
case of their having been active operations at the time at which the
_End's stop(grace) method was called).
Diffstat (limited to 'src')
-rw-r--r-- | src/python/grpcio/grpc/framework/core/_end.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/python/grpcio/grpc/framework/core/_end.py b/src/python/grpcio/grpc/framework/core/_end.py index fb2c532df6..5ef2f6d3a3 100644 --- a/src/python/grpcio/grpc/framework/core/_end.py +++ b/src/python/grpcio/grpc/framework/core/_end.py @@ -30,7 +30,6 @@ """Implementation of base.End.""" import abc -import enum import threading import uuid @@ -75,7 +74,7 @@ def _abort(operations): def _cancel_futures(futures): for future in futures: - futures.cancel() + future.cancel() def _future_shutdown(lock, cycle, event): @@ -83,8 +82,6 @@ def _future_shutdown(lock, cycle, event): with lock: _abort(cycle.operations.values()) _cancel_futures(cycle.futures) - pool = cycle.pool - cycle.pool.shutdown(wait=True) return in_future @@ -113,6 +110,7 @@ def _termination_action(lock, stats, operation_id, cycle): cycle.idle_actions = [] if cycle.grace: _cancel_futures(cycle.futures) + cycle.pool.shutdown(wait=False) return termination_action |