-
Notifications
You must be signed in to change notification settings - Fork 20
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
Bug: slow django-q schedules saturate the queue and are run multiple times #5249
Labels
Milestone
Comments
MichaelAkvo
added a commit
that referenced
this issue
Mar 16, 2023
django-q doesn't support tracking of active task. We therefore cannot make a simple query of "is this task already running". All that is provided is a django signal before a task is executed with the task dictionary https://django-q.readthedocs.io/en/latest/signals.html#before-executing-a-task . That's unfortunately not useful for our scenario as the edge case of an unexpected shutdown will block the unique task from executing in the future. Were a timeout to be added and the task to still be running, the same task could be started again. The chosen solution therefore, is a heartbeat thread.
5 tasks
MichaelAkvo
added a commit
that referenced
this issue
Mar 20, 2023
django-q doesn't support tracking of active task. We therefore cannot make a simple query of "is this task already running". All that is provided is a django signal before a task is executed with the task dictionary https://django-q.readthedocs.io/en/latest/signals.html#before-executing-a-task . That's unfortunately not useful for our scenario as the edge case of an unexpected shutdown will block the unique task from executing in the future. Were a timeout to be added and the task to still be running, the same task could be started again. The chosen solution therefore, is a heartbeat thread.
MichaelAkvo
added a commit
that referenced
this issue
Mar 20, 2023
django-q doesn't support tracking of active task. We therefore cannot make a simple query of "is this task already running". All that is provided is a django signal before a task is executed with the task dictionary https://django-q.readthedocs.io/en/latest/signals.html#before-executing-a-task . That's unfortunately not useful for our scenario as the edge case of an unexpected shutdown will block the unique task from executing in the future. Were a timeout to be added and the task to still be running, the same task could be started again. The chosen solution therefore, is a heartbeat thread.
zuhdil
added a commit
that referenced
this issue
Mar 22, 2023
…aturate-the-queue-and-are-run-multiple-times [#5249] Add decorator to make django-q tasks unique
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What were you doing?
Specifically result framework aggregations can take longer than a minute (which is the frequency of the schedule). That leads to:
What should've happened?
When the aggregation task is running, any renewed attempts to run it should just end.
My environment
No response
Additional context
https://github.com/Koed00/django-q/blob/master/django_q/cluster.py#L660
django-q doesn't check if a scheduled task is already queued or running before scheduling it
The text was updated successfully, but these errors were encountered: