use else in right spot

pull/18112/head
Eric Gribkoff 6 years ago
parent ab5b28538f
commit 93ef0db86b
  1. 5
      src/python/grpcio_health_checking/grpc_health/v1/health.py

@ -118,13 +118,11 @@ class HealthServicer(_health_pb2_grpc.HealthServicer):
status = self._server_status.get(service) status = self._server_status.get(service)
if status is None: if status is None:
status = _health_pb2.HealthCheckResponse.SERVICE_UNKNOWN # pylint: disable=no-member status = _health_pb2.HealthCheckResponse.SERVICE_UNKNOWN # pylint: disable=no-member
else:
send_response_callback( send_response_callback(
_health_pb2.HealthCheckResponse(status=status)) _health_pb2.HealthCheckResponse(status=status))
if service not in self._send_response_callbacks: if service not in self._send_response_callbacks:
self._send_response_callbacks[service] = set() self._send_response_callbacks[service] = set()
self._send_response_callbacks[service].add( self._send_response_callbacks[service].add(send_response_callback)
send_response_callback)
context.add_callback( context.add_callback(
self._on_close_callback(send_response_callback, service)) self._on_close_callback(send_response_callback, service))
return blocking_watcher return blocking_watcher
@ -140,6 +138,7 @@ class HealthServicer(_health_pb2_grpc.HealthServicer):
with self._lock: with self._lock:
if self._gracefully_shutting_down: if self._gracefully_shutting_down:
return return
else:
self._server_status[service] = status self._server_status[service] = status
if service in self._send_response_callbacks: if service in self._send_response_callbacks:
for send_response_callback in self._send_response_callbacks[ for send_response_callback in self._send_response_callbacks[

Loading…
Cancel
Save