Refactor code to improve di pipeline performance (#17820)

This commit is contained in:
IceS2 2024-09-13 11:18:22 +02:00 committed by GitHub
parent dbbd932cf7
commit 4ae318f11b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,6 @@ import static org.openmetadata.service.workflows.searchIndex.ReindexingUtil.ENTI
import static org.openmetadata.service.workflows.searchIndex.ReindexingUtil.TIMESTAMP_KEY;
import static org.openmetadata.service.workflows.searchIndex.ReindexingUtil.getUpdatedStats;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -52,11 +51,14 @@ public class DataInsightsEntityEnricherProcessor
try {
enrichedMaps =
input.getData().stream()
.map(entity -> getEntityVersions(entity, contextData))
.flatMap(Collection::stream)
.map(entityVersionMap -> enrichEntity(entityVersionMap, contextData))
.map(this::generateDailyEntitySnapshots)
.flatMap(Collection::stream)
.flatMap(
entity ->
getEntityVersions(entity, contextData).stream()
.flatMap(
entityVersionMap ->
generateDailyEntitySnapshots(
enrichEntity(entityVersionMap, contextData))
.stream()))
.toList();
updateStats(input.getData().size(), 0);
} catch (Exception e) {