celery-php icon indicating copy to clipboard operation
celery-php copied to clipboard

request.retries comes in as null in the celery worker

Open edu2004eu opened this issue 5 years ago • 2 comments

I'm trying to retry tasks if they fail, using a back-off mechanism:

self.retry(exc=e, countdown=int(random.uniform(2, 4) ** self.request.retries))

When sending tasks from Python's celery, everything works well. Using celery-php to send tasks throws an error when reaching the code above, saying that self.request.retries is None.

Python's celery automatically sends request.retries as 0 on the first schedule of the task.

edu2004eu avatar Jan 23 '19 12:01 edu2004eu

I am also trying to implement the retry and having the same issue.

@edu2004eu did you have any progress on the following issue?

Krismix1 avatar Jun 26 '19 16:06 Krismix1

I am checking whether request.retries is set in the worker, and if not, I set it to 0. My worker is Python, so I have:

    if self.request.retries is None:
        self.request.retries = 0

    self.retry(exc=e, countdown=int(random.uniform(2, 4) ** self.request.retries))

edu2004eu avatar Jul 24 '19 14:07 edu2004eu