-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apalis max retries strategy #503
Comments
This seems like a bug. Your code is not complete though, there is no retry mechanism in your code. |
Thanks for your answer! If you refer to RetryPolicy, infinite loop with processing job happens with and without. Worker:
However, when number of retries reaches limit it just starts from beginning. Seems like job gets added again. Config:
Just to confirm, job should be retried for number Config Regarding RetryPolicy I am wondering, while retrying and waiting for timeout is worker occupied and waiting for timeout to retry or it is serving other jobs in meantime? |
Hmm this is an interesting case. It is possible that the job is killed but that is not handled correctly. I do have a PR open for retries tests. #498 |
Just to answer your question, It should run the number of retries in the policy. In this case it should be 5. Ideally you would have 5 retries in memory, then the storage can decide whether to put it back into the queue. This can repeat until max retries. This behaviour is not standardized but am hoping to do so in the PR currently shared. |
I just noticed that we are experiencing same behaviour:
Jobs that should only be retried once are being retrying forever |
I am working on a test for retries to ensure all storage conform with specific retry behavior on this PR. |
@geofmureithi I think the issue is related to apalis/packages/apalis-redis/src/storage.rs Line 583 in 3cd4233
Which you mentioned on other issue, that retries are not synced with backend. I was able to replicate it with just the default retry layer + policy with the job that returns |
I will work to fix this ASAP |
@geofmureithi After encountering so many issues of various kinds, I wonder if it wouldn't be beneficial to explicitly say on top ofthe readme that Apalis is not production-ready yet (sub v1 might imply it but it wouldn't hurt to be more explicit about it) |
I know when you experience bugs it can be frustrating but the core parts of the project such as Worker and Request are production ready. That has been the biggest focus as it affects everyone. The issues you are facing are related to |
@reneklacan Also remember I had warned that using the default retry layer does not update the backend here and again here |
Getting this exact error using "retry" and "apalis-redis". I see that tower has it's own retry layer available, any guidance on how I can use it in the meantime? Much appreciated for all the work you do, btw! Loving this crate! |
@Tameflame I am almost done with #498 then I will fix the layer to work as expected. There is an example in #399 But I dont recommend to use it as is since it does not sync with the backend. I will do a small PR and we should be good with this ASAP :) |
Thank you for your work on this great package!
I have been trying to use it and would like to clarify how the retry mechanism works in the background.
I am sharing my setup and handler example below.
The issue I am experiencing with the latest apalis and apalis-redis packages is that I am unable to set the maximum retries when the handler fails. When a job fails with the error Error: Failed, it keeps retrying in a loop, even when Config.set_max_retries(2) is set.
I would like to clarify whether this is a bug or a misunderstanding of the library's internals.
I have also used a retry policy, and that seems to work; I can see that the Attempts field gets incremented. However, once it reaches the maximum number of retries defined in the retry policy, it starts over from the beginning and continues in a loop.
One thing I noticed is that when logging RedisContext from the handler, the max_attempts value is set to 0:
Context: RedisContext { max_attempts: 0, lock_by: Some(WorkerId { name: "request_handler" }), run_at: None }
I would like to get information about how to track the number of retries and potentially return an Abort error from the handler, or have this handled automatically.
Additionally, I am interested in learning about the best practices for handling "dead" jobs.
Handler Fn
The text was updated successfully, but these errors were encountered: