cluster.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:aioetcd3 作者: gaopeiliang 项目源码 文件源码
def member_healthy(self, members=None):

        if not members:
            members = await self.member_list()
            members = [m.clientURLs for m in members]

        health_members = []
        unhealth_members = []
        for m in members:

            m = [u.rpartition("//")[2] for u in m]
            server_endpoint = ipv4_endpoints(m)

            if self._credentials:
                channel = aiogrpc.secure_channel(server_endpoint, self._credentials, options=self._options,
                                                 loop=self._loop, executor=self._executor,
                                                 standalone_pool_for_streaming=True)
            else:
                channel = aiogrpc.insecure_channel(server_endpoint, options=self._options, loop=self._loop,
                                                   executor=self._executor, standalone_pool_for_streaming=True)

            maintenance = Maintenance(channel=channel, timeout=2)
            try:
                await maintenance.status()
            except grpc.RpcError:
                unhealth_members.append(m)
            else:
                health_members.append(m)

        return health_members, unhealth_members
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号