Skip to content

Commit

Permalink
rewrite preprocessevent
Browse files Browse the repository at this point in the history
  • Loading branch information
asikowitz committed Feb 4, 2025
1 parent 5ec16fb commit 0382530
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1509,13 +1509,20 @@ private boolean preprocessEvent(
// Deletes cannot rely on System Metadata being passed through so can't always be determined by
// system metadata,
// for all other types of events should use system metadata rather than the boolean param.
if (updateIndicesService != null
&& (preProcessHooks.isUiEnabled()
&& metadataChangeLog.getSystemMetadata() != null
&& metadataChangeLog.getSystemMetadata().getProperties() != null
&& UI_SOURCE.equals(
metadataChangeLog.getSystemMetadata().getProperties().get(APP_SOURCE))
|| forcePreProcessIndices)) {
boolean isUISource =
preProcessHooks.isUiEnabled()
&& metadataChangeLog.getSystemMetadata() != null
&& metadataChangeLog.getSystemMetadata().getProperties() != null
&& UI_SOURCE.equals(
metadataChangeLog.getSystemMetadata().getProperties().get(APP_SOURCE));
boolean syncIndexUpdate =
metadataChangeLog.getHeaders() != null
&& metadataChangeLog
.getHeaders()
.getOrDefault(SYNC_INDEX_UPDATE_HEADER_NAME, "false")
.equalsIgnoreCase(Boolean.toString(true));

if (updateIndicesService != null && (isUISource || syncIndexUpdate || forcePreProcessIndices)) {
updateIndicesService.handleChangeEvent(opContext, metadataChangeLog);
return true;
}
Expand Down

0 comments on commit 0382530

Please sign in to comment.