如果我有一个带有 acks_late=True
的 celery 任务,并且该任务引发了硬超时或软超时异常,那么该任务是被确认并从队列中删除,还是重试? acks_late
的文档无论如何都没有提及。
最佳答案
根据Should I use retry or acks_late ,
Task.retry is used to retry tasks, notably for expected errors that is catchable with the try: block. The AMQP transaction is not used for these errors: if the task raises an exception it is still acknowledged!
由于 SoftTimeLimitExceeded 是一个异常,因此它确实会确认消息并将其从队列中删除。
关于timeout - 超时异常是否使用 acks_late 确认任务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34029222/