async def Check(self, stream):
        """Implements synchronous periodic checks"""
        request = await stream.recv_message()
        checks = self._checks.get(request.service)
        if checks is None:
            await stream.send_trailing_metadata(status=Status.NOT_FOUND)
        elif len(checks) == 0:
            await stream.send_message(HealthCheckResponse(
                status=HealthCheckResponse.SERVING,
            ))
        else:
            for check in checks:
                await check.__check__()
            await stream.send_message(HealthCheckResponse(
                status=_status(checks),
            ))
async def Check ( self , stream ) : request = await stream . recv_message ( ) checks = self . _checks . get ( request . service ) if checks is None : await stream . send_trailing_metadata ( status = Status . NOT_FOUND ) elif len ( checks ) == 0 : await stream . send_message ( HealthCheckResponse ( status = HealthCheckResponse . SERVING , ) ) else : for check in checks : await check . __check__ ( ) await stream . send_message ( HealthCheckResponse ( status = _status ( checks ) , ) )
Implements synchronous periodic checks