每个重试周期增加芹菜重试时间 [英] Increase celery retry time each retry cycle
本文介绍了每个重试周期增加芹菜重试时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我确实像芹菜一样重试芹菜,例如:
I do retries with celery like in the Docs-Example:
@task()
def add(x, y):
try:
...
except Exception, exc:
add.retry(exc=exc, countdown=60) # override the default and
# retry in 1 minute
每次为此发生重试时,如何增加重试倒计时工作-例如60秒,2分钟,4分钟,依此类推,直到出现MaxRetriesExceededed?
How can I increase the retry-countdown everytime the retry occurs for this job - e.g. 60 seconds, 2 minutes, 4 minutes and so on until the MaxRetriesExceeded is raised?
推荐答案
由于版本4.2 您可以使用选项 autoretry_for
和 retry_backoff
目的,例如:
Since version 4.2 you can use options autoretry_for
and retry_backoff
for this purposes, for example:
@task(max_retries=10, autoretry_for=(Exception,), retry_backoff=60)
def add(x, y):
pass
这篇关于每个重试周期增加芹菜重试时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文