mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 07:25:56 +03:00
[GH-ISSUE #472] [FEATURE REQUEST] Self-Managed Retries #2240
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#2240
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AlexCuse on GitHub (May 17, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/472
Originally assigned to: @hibiken on GitHub.
Is your feature request related to a problem? Please describe.
I would like to be able to leverage "processor managed" retries for specific tasks running through an asynq server.
Describe the solution you'd like
I will have a PR shortly for a
SelfManagedRetryoption that will override Retry/Retried logic to retry a task indefinitely (from asynq's perspective) allowing the processor to terminate by either returning success or SkipRetry.Describe alternatives you've considered
Looked at the options around "consuming retry count" and thought about figuring considered setting a high number of retries since looking at this within a fairly short expiration right now but came around to favoring something a little more direct.
There is a risk of tasks retrying indefinitely if not self-managed correctly but this should be difficult to fall into without using the option.
@hibiken commented on GitHub (May 18, 2022):
@AlexCuse Thank you for creating an issue.
Have you taken a look at
Config.IsFailure?You can provide this function to determine whether the error returned from the
Handlershould be considered a failure. Non-failure error won't consume the retry count; You can leverage this feature to try task indefinitely if you so choose.See this wiki for more info (https://github.com/hibiken/asynq/wiki/Task-Retry#non-failure-error)
@AlexCuse commented on GitHub (May 18, 2022):
I have looked at it @hibiken - the problem with most of what is there is that its not task type specific. We have a subset of critical tasks that are "chained" so to speak and we really only want to change the behavior for those tasks - the idea is to retry up to an expiration that is encoded in the task payloads, and once the expiration is hit to move the task into a cancellation queue where processors will clean up any progress associated with the attempt.
Maybe another option could be to make the existing methods task-type aware?
@hibiken commented on GitHub (May 18, 2022):
Can you define your own error type and include task type?
e.g.
@AlexCuse commented on GitHub (May 18, 2022):
We could I'm not sure how attractive it is as the number of registered processors in the system grows though. Will think a bit about how far this could get us.
@AlexCuse commented on GitHub (May 18, 2022):
@hibiken it occurs to me thinking about this that a custom
IsFailurefunc registered with the processor could be preferable to the additional option in some (most?) ways. I will look into ways this could be achieved but is that something that might be more attractive than a task level option?@hibiken commented on GitHub (May 18, 2022):
I believe the options we offer now (
MaxRetryoption andIsFailurecallback) are generic enough to accommodate most use cases. I don't see adding a new option to further customize retry logic.@AlexCuse commented on GitHub (May 19, 2022):
Thanks for the quick response @hibiken i disagree but we will be able to muddle through with what's there for awhile. I have already changed the code and will probably open the PR anyway once I've tested it in a running system in case you change your mind, seems like a pretty simple change.