December 2018
Beginner to intermediate
796 pages
19h 54m
English
As we saw, Celery tasks may be restarted several times, especially if you have enabled late acknowledgments. This makes it important to control the side effects of a task. Hence, Celery recommends that all tasks should be idempotent. Idempotence is a mathematical property of a function that assures that it will return the same result if invoked with the same arguments, no matter how many times you call it.
You might have seen simple examples of idempotent functions in the Celery documentation itself, such as this:
@app.task
def add(x, y):
return x + y
No matter how many times we call this function, the result of add(2, 2) is always 4.
However, it is important to understand the difference between an idempotent function and ...
Read now
Unlock full access