diff --git a/openedx/core/djangoapps/content/search/handlers.py b/openedx/core/djangoapps/content/search/handlers.py index b41c0e5d7851..6a341c92ed2b 100644 --- a/openedx/core/djangoapps/content/search/handlers.py +++ b/openedx/core/djangoapps/content/search/handlers.py @@ -167,10 +167,13 @@ def library_collection_updated_handler(**kwargs) -> None: log.error("Received null or incorrect data for event") return - update_library_collection_index_doc.delay( + # Update collection index synchronously to make sure that search index is updated before + # the frontend invalidates/refetches index. + # See content_library_updated_handler for more details. + update_library_collection_index_doc.apply(args=[ str(library_collection.library_key), library_collection.collection_key, - ) + ]) @receiver(CONTENT_OBJECT_ASSOCIATIONS_CHANGED)