Fixing the docstring wording

pull/21621/head
Lidi Zheng 5 years ago
parent f75ce34da7
commit 0afc05cef5
  1. 19
      src/python/grpcio/grpc/experimental/aio/_channel.py
  2. 4
      src/python/grpcio_tests/tests_aio/unit/connectivity_test.py

@ -230,17 +230,14 @@ class Channel:
This is an EXPERIMENTAL API.
It's the nature of connectivity states to change. The returned
connectivity state might become obsolete soon. Combining
"Channel.wait_for_state_change" we guarantee the convergence of
connectivity state between application and ground truth.
If the channel reaches a stable connectivity state, it is guaranteed
that the return value of this function will eventually converge to that
state.
Args:
try_to_connect: a bool indicate whether the Channel should try to
connect to peer or not.
Args: try_to_connect: a bool indicate whether the Channel should try to
connect to peer or not.
Returns:
A ChannelConnectivity object.
Returns: A ChannelConnectivity object.
"""
result = self._channel.check_connectivity_state(try_to_connect)
return _common.CYGRPC_CONNECTIVITY_STATE_TO_CHANNEL_CONNECTIVITY.get(
@ -260,8 +257,8 @@ class Channel:
There is an inherent race between the invocation of
"Channel.wait_for_state_change" and "Channel.get_state". The state can
arbitrary times during the race, so there is no way to observe every
state transition.
change arbitrary times during the race, so there is no way to observe
every state transition.
If there is a need to put a timeout for this function, please refer to
"asyncio.wait_for".

@ -100,9 +100,9 @@ class TestConnectivityState(AioTestBase):
self.assertEqual(grpc.ChannelConnectivity.SHUTDOWN,
channel.get_state(False))
# It can raise Exception since it is an usage error, but it should not
# It can raise exceptions since it is an usage error, but it should not
# segfault or abort.
with self.assertRaises(Exception):
with self.assertRaises(RuntimeError):
await channel.wait_for_state_change(
grpc.ChannelConnectivity.SHUTDOWN)

Loading…
Cancel
Save