Skip to content

Commit

Permalink
feat: make course -> lib import synchronous (#34030)
Browse files Browse the repository at this point in the history
* feat: make course -> lib import synchronous

---------

Co-authored-by: Kyle McCormick <[email protected]>
  • Loading branch information
connorhaugh and kdmccormick authored Jan 9, 2024
1 parent 8d2ddd7 commit 2b47b8a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions xmodule/library_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,16 @@ def trigger_library_sync(self, dest_block: LibraryContentBlock, library_version:
if library_version:
raise ObjectDoesNotExist(f"Version {library_version} of library {library_key} not found.")
raise ObjectDoesNotExist(f"Library {library_key} not found.")
library_tasks.sync_from_library.delay(
user_id=self.user_id,
dest_block_id=str(dest_block.scope_ids.usage_id),
library_version=library_version,

# TODO: This task is synchronous until we can figure out race conditions with import.
# These race conditions lead to failed imports of library content from course import.
# See: TNL-11339, https://github.com/openedx/edx-platform/issues/34029 for more info.
library_tasks.sync_from_library.apply(
kwargs=dict(
user_id=self.user_id,
dest_block_id=str(dest_block.scope_ids.usage_id),
library_version=library_version,
),
)

def trigger_duplication(self, source_block: LibraryContentBlock, dest_block: LibraryContentBlock) -> None:
Expand Down

0 comments on commit 2b47b8a

Please sign in to comment.