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 50839bd commit ce27ec3
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,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 @@ -299,19 +298,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 ce27ec3

Please sign in to comment.