Make updateSiblings and resetChildrenIndexBy fully async#426
Open
cancan101 wants to merge 2 commits into
Open
Conversation
The updateDataObject and updateDocument event subscribers were calling IndexElementIndexService::updateSiblings() and resetChildrenIndexBy() synchronously, which made blocking calls to the search provider during HTTP requests. This caused significant slowdowns for large folders. Dispatch an UpdateSiblingsMessage via the message bus so that sibling and children index updates are processed asynchronously through the existing queue infrastructure, consistent with how updateData() works.
Tests cover: - UpdateSiblingsHandler: verifies service method dispatch based on element type, sort-by-index flag, resetChildrenIndexBy flag, and null element handling - DataObjectIndexUpdateSubscriber: verifies UpdateSiblingsMessage is dispatched with correct parameters - DocumentIndexUpdateSubscriber: same verification for documents
|
Contributor
Author
|
Follow up PR: cancan101#2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Changes in this pull request
Resolves #389
Additional info
DataObjectIndexUpdateSubscriber::updateDataObject()andDocumentIndexUpdateSubscriber::updateDocument()were callingIndexElementIndexService::updateSiblings()andresetChildrenIndexBy()synchronously, making blocking calls to the search provider (e.g. OpenSearch/Elasticsearch) during HTTP requestsUpdateSiblingsMessageandUpdateSiblingsHandlerto dispatch sibling/children index updates via the Symfony Messenger bus, so they are processed asynchronously through the existingpimcore_generic_data_index_queuetransportIndexElementIndexServiceInterfacedependency from both event subscribers, replacing it withMessageBusInterfaceto dispatch the new messageThis eliminates the synchronous search-provider roundtrips that caused significant slowdowns during object updates, especially for large folders.
Test plan
UpdateSiblingsMessageto the queue instead of blockingUpdateSiblingsMessageto the queue instead of blockingresetChildrenIndexByis triggered for data objects withOBJECT_CHILDREN_SORT_BY_INDEXsort modeconfig/pimcore/messenger.yaml