Skip to content

Commit

Permalink
feat: When editing a v2 library xblock, update search index synchrono…
Browse files Browse the repository at this point in the history
…usly (#35495)
  • Loading branch information
bradenmacdonald authored Sep 18, 2024
1 parent 3de0dbd commit 00632d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions openedx/core/djangoapps/content/search/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def library_block_updated_handler(**kwargs) -> None:
log.error("Received null or incorrect data for event")
return

upsert_library_block_index_doc.delay(str(library_block_data.usage_key))
# Update content library index synchronously to make sure that search index is updated before
# the frontend invalidates/refetches results. This is only a single document update so is very fast.
upsert_library_block_index_doc.apply(args=[str(library_block_data.usage_key)])


@receiver(LIBRARY_BLOCK_DELETED)
Expand All @@ -138,7 +140,9 @@ def library_block_deleted(**kwargs) -> None:
log.error("Received null or incorrect data for event")
return

delete_library_block_index_doc.delay(str(library_block_data.usage_key))
# Update content library index synchronously to make sure that search index is updated before
# the frontend invalidates/refetches results. This is only a single document update so is very fast.
delete_library_block_index_doc.apply(args=[str(library_block_data.usage_key)])


@receiver(CONTENT_LIBRARY_UPDATED)
Expand Down

0 comments on commit 00632d9

Please sign in to comment.