擅长:python、mysql、java
<p>我更喜欢限制重试次数,这样,如果特定项目有问题,您最终将继续执行下一个项目,因此:</p>
<pre><code>for i in range(100):
for attempt in range(10):
try:
# do thing
except:
# perhaps reconnect, etc.
else:
break
else:
# we failed all the attempts - deal with the consequences.
</code></pre>