根据我的经验,我认为您可以尝试使用下面的代码来实现重试逻辑。
import timeretry_flag = Trueretry_count = 0while retry_flag and retry_count < 5: try: cursor.execute(query, [args['type'], args['id']]) retry_flag = False except: print "Retry after 1 sec" retry_count = retry_count + 1 time.sleep(1)
希望能帮助到你。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)