spamscope_elasticsearch.py 文件源码

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

项目:spamscope 作者: SpamScope 项目源码 文件源码
def update_template(es, max_retry, template_path, template_name):
    with open(template_path) as f:
        body = f.read()

    for i in range(max_retry, 0, -1):
        try:
            es.indices.put_template(name=template_name, body=body)
            log.info("Updating template {!r} done".format(template_name))
            return

        except (ConnectionError, NotFoundError):
            log.warning(
                "Updating template {!r} failed. Waiting for {} sec".format(
                    template_name, i))
            time.sleep(i)

    log.error("Updating template {!r} definitely failed".format(template_name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号