diff options
author | Ken Payson <kpayson@google.com> | 2017-05-16 10:30:59 -0700 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2017-05-22 10:07:25 -0700 |
commit | 8f7bc54ff2256179ede6d4a6d1a8792b7820fc28 (patch) | |
tree | fcd48b3be57deaf02d271e4f3d2296bccd320f5f /src/python/grpcio | |
parent | 5ef2087de7067435c321c9e634aefd7b80441295 (diff) |
Reconnect disconnected channels automatically
Diffstat (limited to 'src/python/grpcio')
-rw-r--r-- | src/python/grpcio/grpc/_channel.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/python/grpcio/grpc/_channel.py b/src/python/grpcio/grpc/_channel.py index 4316449ac6..012ed8ec81 100644 --- a/src/python/grpcio/grpc/_channel.py +++ b/src/python/grpcio/grpc/_channel.py @@ -786,7 +786,7 @@ def _channel_managed_call_management(state): class _ChannelConnectivityState(object): def __init__(self, channel): - self.lock = threading.Lock() + self.lock = threading.RLock() self.channel = channel self.polling = False self.connectivity = None @@ -926,6 +926,11 @@ class Channel(grpc.Channel): self._call_state = _ChannelCallState(self._channel) self._connectivity_state = _ChannelConnectivityState(self._channel) + # TODO(https://github.com/grpc/grpc/issues/9884) + # Temporary work around UNAVAILABLE issues + # Remove this once c-core has retry support + _subscribe(self._connectivity_state, lambda *args: None, None) + def subscribe(self, callback, try_to_connect=None): _subscribe(self._connectivity_state, callback, try_to_connect) |