-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
fix(exports): tasks stuck in processing TASK-1243 #5436
Conversation
kpi/tasks.py
Outdated
@@ -14,26 +15,36 @@ | |||
from kpi.models.asset import Asset | |||
from kpi.models.import_export_task import ImportTask, SubmissionExportTask | |||
|
|||
SLEEP_TIME = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I left some tiny comments which are not blockers to merge this PR.
It would be great to address them, though ;-)
kpi/tasks.py
Outdated
@@ -14,26 +15,36 @@ | |||
from kpi.models.asset import Asset | |||
from kpi.models.import_export_task import ImportTask, SubmissionExportTask | |||
|
|||
SLEEP_TIME = 2 | |||
RETRIES = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, I would add this to django settings instead having the constant in the file.
🗒️ Checklist
<type>(<scope>)<!>: <title> TASK-1234
frontend
orbackend
unless it's global📣 Summary
Fixes occasional problem where tasks end up showing as 'Processing' forever.
💭 Notes
Tasks were failing when the celery task started too quickly and tried to fetch the task before it had actually hit the database. This PR implements 2 guards against this:
task.retry
takes care of putting some time in between retries👀 Preview steps
This bug tends to only appear in low traffic when the celery queue is empty. Make sure
CELERY_TASK_ALWAYS_EAGER
is false.kpi.models.import_export_task.SubmissionExportTask.DoesNotExist: SubmissionExportTask matching query does not exist