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
memberships.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录