Repository: celery/celery

Issue:
Document and code are inconsistent about task_reject_on_worker_lost config
<!--
Please fill this template entirely and do not erase parts of it.
We reserve the right to close without a response
bug reports which are incomplete.
-->
# Checklist
<!--
To check an item on the list replace [ ] with [x].
-->

- [x] I have checked the [issues list](https://github.com/celery/celery/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22Category%3A+Documentation%22+)
  for similar or identical bug reports.
- [x] I have checked the [pull requests list](https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22Category%3A+Documentation%22)
  for existing proposed fixes.
- [x] I have checked the [commit log](https://github.com/celery/celery/commits/master)
  to find out if the bug was already fixed in the master branch.
- [x] I have included all related issues and possible duplicate issues in this issue
      (If there are none, check this box anyway).

## Related Issues and Possible Duplicates
<!--
Please make sure to search and mention any related issues
or possible duplicates to this issue as requested by the checklist above.

This may or may not include issues in other repositories that the Celery project
maintains or other repositories that are dependencies of Celery.

If you don't know how to mention issues, please refer to Github's documentation
on the subject: https://help.github.com/en/articles/autolinked-references-and-urls#issues-and-pull-requests
-->

#### Related Issues

- None

#### Possible Duplicates

- None

# Description
<!--
Please describe what's missing or incorrect about our documentation.
Include links and/or screenshots which will aid us to resolve the issue.
-->
In the latest version of the documentation about  [task_reject_on_worker_lost](http://docs.celeryproject.org/en/latest/userguide/configuration.html?highlight=task_reject_on_worker_lost), it says `Enabling this can cause message loops`

But actually, enabling this will not cause message loops, tasks only execute twice.Tasks that have been redelivered will not be redelivered again, [source code](https://github.com/celery/celery/blob/master/celery/worker/request.py#L518)


# Suggestions
<!-- Please provide us suggestions for how to fix the documentation -->
If it is a documentation error,  it is best to remove the warning from the document.
If the document is ok, it is need to modify the code.
I can help modify the document or code.



Discussion:
feel free to come with a PR?

Resolving patch:
diff --git a/celery/worker/request.py b/celery/worker/request.py
--- a/celery/worker/request.py
+++ b/celery/worker/request.py
@@ -505,7 +505,7 @@ def on_failure(self, exc_info, send_failed_event=True, return_ok=False):
             )
             ack = self.task.acks_on_failure_or_timeout
             if reject:
-                requeue = not self.delivery_info.get('redelivered')
+                requeue = True
                 self.reject(requeue=requeue)
                 send_failed_event = False
             elif ack:


Test patch:
diff --git a/t/unit/worker/test_request.py b/t/unit/worker/test_request.py
--- a/t/unit/worker/test_request.py
+++ b/t/unit/worker/test_request.py
@@ -653,7 +653,7 @@ def test_on_failure_acks_late_reject_on_worker_lost_enabled(self):
         job.delivery_info['redelivered'] = True
         job.on_failure(exc_info)
 
-        assert self.mytask.backend.get_status(job.id) == states.FAILURE
+        assert self.mytask.backend.get_status(job.id) == states.PENDING
 
     def test_on_failure_acks_late(self):
         job = self.xRequest()