mesh.py 文件源码

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

项目:raptiformica 作者: vdloo 项目源码 文件源码
def join_consul_neighbours(mapping):
    """
    Consul join all known neighbours. Will join as many instances at
    the same time as threads in the threadpool.
    :param dict mapping: Key value mapping with the config data
    :return None:
    """
    ipv6_addresses = get_neighbour_hosts(mapping)
    shuffle(ipv6_addresses)
    new_ipv6_addresses = list(
        filter(not_already_known_consul_neighbour, ipv6_addresses)
    )
    pool = ThreadPool()
    groups = group_n_elements(
        new_ipv6_addresses, CONSUL_JOIN_BATCH_SIZE
    )
    for ipv6_addresses in groups:
        pool.apply_async(try_run_consul_join, args=(ipv6_addresses,))
    pool.close()
    pool.join()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号