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

Add a warning for misconfiguration. #509

Merged
merged 5 commits into from
Feb 26, 2021
Merged

Add a warning for misconfiguration. #509

merged 5 commits into from
Feb 26, 2021

Conversation

icfly2
Copy link
Contributor

@icfly2 icfly2 commented Feb 16, 2021

As specified in the docs, by default the settings result in a configuration where slow tasks that run for more than 60s cause repeated running of tasks, which has caused a few issues. This warning doesn't change the defaults, which would be a marge larger change, but instead provides a, hopefully, helpful message to the user.

This has caused issues before: #183 and others.

And it confused me, and only careful reading of the docs reveals this.

As specified in the docs, by default the settings result in a configuration where slow tasks that run for more than 60s cause repeated running of tasks, which has caused a few issues. This warning doesn't change the defaults, which would be a marge larger change, but instead provides a, hopefully, helpful message to the user.
fixed spelling
Made bool work for python 3.6+
Copy link
Owner

@Koed00 Koed00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing that. After fixing typo, I will merge and put it in the next release

django_q/conf.py Outdated Show resolved Hide resolved
@Koed00 Koed00 merged commit 7892aef into Koed00:master Feb 26, 2021
@jonaswinkler
Copy link

Just came here to let you know that this warning is also raised with the default configuration (timeout=None, retry=60), which works perfectly fine with redis, even with long running tasks.

@Koed00
Copy link
Owner

Koed00 commented Feb 26, 2021

I didn't spot that earlier. I guess we can take out the check for TIMEOUT to be not None.

@icfly2
Copy link
Contributor Author

icfly2 commented Feb 27, 2021

I haven’t tested this with a redis backend but from the docs it implies that timeout = None would lead to never timing out for all backends and then this problem should persist. If it doesn’t, maybe exclude redis and other backends where this issue doesn’t occur.

Just came here to let you know that this warning is also raised with the default configuration (timeout=None, retry=60), which works perfectly fine with redis, even with long running tasks.

Yes the default leads to problems with long running tasks, thus the warning also in default. Can you confirm that a task that takes longer than 60 seconds does not get called repeatedly with a redis backend?

@jonaswinkler
Copy link

Can you confirm that a task that takes longer than 60 seconds does not get called repeatedly with a redis backend?

I can confirm that even with 'retry=1', no long running tasks get repeated at all. As expected, since the documentation states this option won't have any effect with brokers that don't support delivery receipts, and redis is one of those.

Also, the system check framework would probably be a much better tool to implement checks like this one.

@icfly2
Copy link
Contributor Author

icfly2 commented Mar 1, 2021

Just checked the docs and as far as I can see only Redis doesn't support delivery receipts. I guess the nicest way to do this would be to check for the attribute / function that is used for delivery receipts, else a list of brokers could be fine and the assumption that if you are using a custom broker you know what you are doing.

@markopy
Copy link

markopy commented Mar 8, 2021

I get this warning as well with the latest version. I'm setting timeout=None explicitly and I don't want any retries to happen (using ack_failures=True). It seems there is no combination of settings which avoids the warning for this use case. retry cannot be set to None either.

@icfly2
Copy link
Contributor Author

icfly2 commented Mar 12, 2021

@markopy What backend are you using?

@markopy
Copy link

markopy commented Mar 13, 2021

@icfly2 I use the orm backend in this case. I think for my case the issue is also that (aside from setting ack_failures=True) there is no real way to actually disable retries so setting timeout=None basically never makes sense unless the backend doesn't support delivery receipts. Which seems to be only Redis.

I have resolved this issue by simply setting timeout and retry to very large numbers. I think the documentation and default settings are misleading here. timeout should never be None unless you are doing something very specific.

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

Successfully merging this pull request may close these issues.

4 participants