for try_i in range(6):
try:
result = clt.do_action_with_exception(request)
break
except Exception as e:
print("{}".format(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))))
print(e)
self.logger.error(self.log_mgr.err_format(e))
if try_i >= 3:
msg = '报警: {} try {} err: {} '.format(os.path.abspath(__file__), try_i, str(e))
# print(msg)
SendAlertToDD.dingding_warn(dingding_token, msg)
time.sleep(30)
python 失败重试逻辑
最新推荐文章于 2024-07-28 15:46:11 发布