Merge pull request #4493 from edx/studio/bulk-edit-dont-update-ancestors
Don't update ancestors while bulk editing.
This commit is contained in:
@@ -432,6 +432,13 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
self.ignore_write_events_on_courses.remove(course_id)
|
||||
self.refresh_cached_metadata_inheritance_tree(course_id)
|
||||
|
||||
def _is_bulk_write_in_progress(self, course_id):
|
||||
"""
|
||||
Returns whether a bulk write operation is in progress for the given course.
|
||||
"""
|
||||
course_id = course_id.for_branch(None)
|
||||
return course_id in self.ignore_write_events_on_courses
|
||||
|
||||
def fill_in_run(self, course_key):
|
||||
"""
|
||||
In mongo some course_keys are used without runs. This helper function returns
|
||||
@@ -582,7 +589,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
a runtime may mean that some objects report old values for inherited data.
|
||||
"""
|
||||
course_id = course_id.for_branch(None)
|
||||
if course_id not in self.ignore_write_events_on_courses:
|
||||
if not self._is_bulk_write_in_progress(course_id):
|
||||
# below is done for side effects when runtime is None
|
||||
cached_metadata = self._get_cached_metadata_inheritance_tree(course_id, force_refresh=True)
|
||||
if runtime:
|
||||
@@ -1106,7 +1113,10 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
|
||||
# update subtree edited info for ancestors
|
||||
# don't update the subtree info for descendants of the publish root for efficiency
|
||||
if (not isPublish) or (isPublish and is_publish_root):
|
||||
if (
|
||||
(not isPublish or (isPublish and is_publish_root)) and
|
||||
not self._is_bulk_write_in_progress(xblock.location.course_key)
|
||||
):
|
||||
ancestor_payload = {
|
||||
'edit_info.subtree_edited_on': now,
|
||||
'edit_info.subtree_edited_by': user_id
|
||||
|
||||
Reference in New Issue
Block a user