memberships.py 文件源码

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

项目:analytics-platform-ops 作者: ministryofjustice 项目源码 文件源码
def retry(fn, max_attempts=10, delay=0.200):
    attempts = 0
    while True:
        try:
            fn()
            break
        except botocore.exceptions.ClientError as error:
            # Only retry on boto's ClientError/NoSuchEntity error
            if error.response["Error"]["Code"] == "NoSuchEntity":
                LOG.warning(
                    "error while attaching role to policy: {}.".format(error))
                attempts += 1
                if attempts < max_attempts:
                    LOG.warning("Retry in {}s...".format(delay))
                    time.sleep(delay)
                else:
                    raise
            else:
                raise
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号