Skip to content
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

Prevent retry in case of failure (max_attempts) #495

Closed
stuhli opened this issue Dec 18, 2020 · 1 comment
Closed

Prevent retry in case of failure (max_attempts) #495

stuhli opened this issue Dec 18, 2020 · 1 comment

Comments

@stuhli
Copy link

stuhli commented Dec 18, 2020

Hello,

is there a way to prevent Scheduled tasks from retrying in case of failure? I haved worked with Scheduled tasks for a while now and I observed the following behavior:

  • 'max_attempts': 1, leads to Attempt count: 2, that is, two attempts were made to execute the task (same what my own application logs tell me), obviously the "1" is one retry attempt?
  • 'max_attempts': 0, leads to unlimited attempts.

But there are use cases where I don't want a broken task to be executed again, because the chances are high that it will - without interference - break again and does some more unwanted stuff. I can imagine that this also applies to other users / applications?

The documentation says:
Limit the number of retry attempts for failed tasks. Set to 0 for infinite retries. Defaults to 0

It is probably intentional, but - in my opinion - not stringent with the configuration of the scheduled tasks per se. If I configure a Scheduled task via admin interface, Repeats: -1 means unlimited repeats, Repeats: 0 should do nothing (if not used combined with Once) and Repeats: 1 does exactly one execution.

And I don't have the chance to tell the application in the configuration "try this just once and in case of error let it be".

Or do I missing something?

Thanks for your answer / help
stuhli

PS:
And thank all of you for your great work with improving Django Q!!!

@stuhli
Copy link
Author

stuhli commented Dec 18, 2020

Locking for something completely different, I stumbled over #194 and #466. Obviously, I'm never lucky with my search terms...

So I close this for now and check that. If that doesn't answer my question, I'll reopen this issue.

@stuhli stuhli closed this as completed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant