-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Timeout override is lost when sent to broker #332
Comments
I made a small patch which fixes the issue for me: #333. |
I was also reading the documentation like you said but started testing stuff and you can get timeouts to work by giving the timeout argument for schedule function:
When fixing this you might want to consider this. |
I'll try that on Monday. If that's the solution and works, there's still a bug, at least in the documentation. |
Also note that there is a bit related issue in timeout handling: #335 |
I confirm that this works. In the database the So I think either
A maintainer will have to clarify if either of these is correct. #335 is noted but doesn't affect me since I would never want no timeout as the default. |
I'm running django-q version 1.0.1.
I have the timeout set to 5 seconds since most tasks are very short. I have one longer scheduled task for which I want to override the timeout to 120 seconds.
According to the documentation, I can schedule it and override the timeout with
When I look at the schedule table after doing this I see that the q_options has made its way into the kwargs column, and that kwargs will look like
{'q_options': {'timeout': 120}}
.But this task is timing out after 5 seconds every time it runs.
I did some digging into the source code and added a bunch of trace messages. I found that in https://github.com/Koed00/django-q/blob/master/django_q/tasks.py#L21
q_options
correctly contains the timeout. That is popped out of thekeywords
dict.timeout
is not part of the list ofopt_keys
and so the timeout is not added to thetask
dict, and since it's no longer part ofkeywords
it's also not added to the task'skwargs
key. It therefore doesn't exist anywhere in what is sent to the broker.The cluster then expects to find the timeout as part of the
kwargs
dict here: https://github.com/Koed00/django-q/blob/master/django_q/cluster.py#L371 but as far as I can tell it will never be present.This seems to me like a bug. Or am I missing something?
The text was updated successfully, but these errors were encountered: