<p dir="auto">If a Task object has a non None value for max_retries, we can't set max_retries to None when raising a retry.  The retry method uses None as a default value, so it falls back to the Task's current max_retries value.</p>
<p dir="auto">In the task documentation the max_retries states that a value of None will make the task retry forever <a href="http://celery.readthedocs.org/en/latest/reference/celery.app.task.html#celery.app.task.Task.max_retries" rel="nofollow">http://celery.readthedocs.org/en/latest/reference/celery.app.task.html#celery.app.task.Task.max_retries</a> . However in the Task.retry() code line 635 you do</p>
<p dir="auto">max_retries = self.max_retries if max_retries is None else max_retries</p>
<p dir="auto">max_retries is passed in with a default value of None and it appears you are using that to check if someone called it with a different value. otherwise use old value which will default to 3.</p>
<p dir="auto">What I'm trying to get at here is that it appears that unless someone uses the task decorator to set max_retries to None you can't have the task retry forever. perhaps using a different value to indicate retry forever like -1 is better as changing the function definition might break thing for people.</p>