Run subsection completion milestones task async.

This function is a celery task but it seems like it is not being
called correctly.  The way it was, it would run in process. We
update the call so that it is called asynchronously as a celery
task instead.

This may have some user facing impact as the work might now take
longer to do than when it was running in the request process.

However leaving it as is, definitely makes the user experience slower
causes us to do computationally intensive work in the web request. It
also makes it much harder to monitor as our ownership assignment tracking
for the feature does not work correctly.
This commit is contained in:
Feanil Patel
2020-11-13 13:46:48 -05:00
parent 280d45dbc2
commit eeae57597d

View File

@@ -42,7 +42,7 @@ def evaluate_subsection_completion_milestones(**kwargs):
return # Content in a library or some other thing that doesn't support milestones
block_id = six.text_type(instance.block_key)
user_id = instance.user_id
task_evaluate_subsection_completion_milestones(course_id, block_id, user_id)
task_evaluate_subsection_completion_milestones.delay(course_id, block_id, user_id)
@receiver(COURSE_GRADE_CHANGED)