Merge pull request #21903 from lidizheng/aio-fix-close

[Aio] Attempt to fix recent AsyncIO windows flake
pull/21857/head
Lidi Zheng 5 years ago committed by GitHub
commit c564d28f9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/python/grpcio/grpc/experimental/aio/_channel.py
  2. 4
      src/python/grpcio_tests/tests_aio/unit/close_channel_test.py

@ -44,7 +44,10 @@ class _OngoingCalls:
self._calls = WeakSet()
def _remove_call(self, call: _base_call.RpcContext):
self._calls.remove(call)
try:
self._calls.remove(call)
except KeyError:
pass
@property
def calls(self) -> AbstractSet[_base_call.RpcContext]:

@ -24,11 +24,11 @@ from grpc.experimental.aio import _base_call
from grpc.experimental.aio._channel import _OngoingCalls
from src.proto.grpc.testing import messages_pb2, test_pb2_grpc
from tests_aio.unit._constants import UNARY_CALL_WITH_SLEEP_VALUE
from tests_aio.unit._test_base import AioTestBase
from tests_aio.unit._test_server import start_test_server
_UNARY_CALL_METHOD_WITH_SLEEP = '/grpc.testing.TestService/UnaryCallWithSleep'
_LONG_TIMEOUT_THAT_SHOULD_NOT_EXPIRE = 60
class TestOngoingCalls(unittest.TestCase):
@ -90,7 +90,7 @@ class TestCloseChannel(AioTestBase):
call = UnaryCallWithSleep(messages_pb2.SimpleRequest())
await channel.close(grace=UNARY_CALL_WITH_SLEEP_VALUE * 4)
await channel.close(grace=_LONG_TIMEOUT_THAT_SHOULD_NOT_EXPIRE)
self.assertEqual(grpc.StatusCode.OK, await call.code())

Loading…
Cancel
Save