Daenyth
Daenyth

Reputation: 37441

Does a timeout exception ack a task with acks_late?

If I have a celery task with acks_late=True, and that task raises either a hard or soft timeout exception, is the task acked and removed from the queue, or is it retried? The documentation for acks_late doesn't mention it either way.

Upvotes: 2

Views: 2234

Answers (1)

Daenyth
Daenyth

Reputation: 37441

According to 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!

Since SoftTimeLimitExceeded is an exception, it stands to reason that it does ack the message and removes it from the queue.

Upvotes: 4

Related Questions