|
|
@ -43,18 +43,13 @@ class AsyncHealthServicer(_health_pb2_grpc.HealthServicer): |
|
|
|
try: |
|
|
|
try: |
|
|
|
async with condition: |
|
|
|
async with condition: |
|
|
|
while True: |
|
|
|
while True: |
|
|
|
status = self._server_status.get(request.service) |
|
|
|
status = self._server_status.get( |
|
|
|
|
|
|
|
request.service, |
|
|
|
if status: |
|
|
|
_health_pb2.HealthCheckResponse.SERVICE_UNKNOWN) |
|
|
|
# Responds with current health state |
|
|
|
|
|
|
|
await context.write( |
|
|
|
# Responds with current health state |
|
|
|
_health_pb2.HealthCheckResponse(status=status)) |
|
|
|
await context.write( |
|
|
|
else: |
|
|
|
_health_pb2.HealthCheckResponse(status=status)) |
|
|
|
# Responds with default value |
|
|
|
|
|
|
|
await context.write( |
|
|
|
|
|
|
|
_health_pb2.HealthCheckResponse( |
|
|
|
|
|
|
|
status=_health_pb2.HealthCheckResponse. |
|
|
|
|
|
|
|
SERVICE_UNKNOWN)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Polling on health state changes |
|
|
|
# Polling on health state changes |
|
|
|
await condition.wait() |
|
|
|
await condition.wait() |
|
|
|