Skip to content

Commit

Permalink
mesh-184: optimised linked assets check code
Browse files Browse the repository at this point in the history
  • Loading branch information
PRATHAM2002-DS committed Sep 10, 2024
1 parent 462c6a8 commit 89b6330
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ protected List<AtlasEntityHeader> getPolicies(Set<String> resources) throws Atla

protected Boolean hasLinkedAssets(String domainGuid) throws AtlasBaseException {
AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("isAssetLinked");
boolean exists = false;
try {
List<Map<String, Object>> mustClauseList = new ArrayList<>();
mustClauseList.add(mapOf("term", mapOf(DOMAIN_GUIDS, domainGuid)));
Expand All @@ -300,19 +299,14 @@ protected Boolean hasLinkedAssets(String domainGuid) throws AtlasBaseException {

Map<String, Object> dsl = mapOf("query", mapOf("bool", bool));

boolean hasLinkedAsset = fetchLinkedAssets(dsl, DOMAIN_GUID_ATTR, this.discovery);
if (hasLinkedAsset) {
exists = true;
}

return exists;
return hasLinkedAssets(dsl, DOMAIN_GUID_ATTR, this.discovery);

} finally {
RequestContext.get().endMetricRecord(metricRecorder);
}
}

protected static Boolean fetchLinkedAssets(Map<String, Object> dsl, Set<String> attributes, EntityDiscoveryService discovery) throws AtlasBaseException {
protected static Boolean hasLinkedAssets(Map<String, Object> dsl, Set<String> attributes, EntityDiscoveryService discovery) throws AtlasBaseException {
IndexSearchParams searchParams = new IndexSearchParams();
boolean exists = false;

Expand Down

0 comments on commit 89b6330

Please sign in to comment.