Skip to content

Commit

Permalink
Merge pull request #2811 from atlanhq/startupTime
Browse files Browse the repository at this point in the history
Improve Atlas Startup time
  • Loading branch information
aarshi0301 authored Jan 31, 2024
2 parents 5760d48 + 6d8b03e commit 6b7d1fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,9 @@ private void resolveIndexFieldName(AtlasGraphManagement managementSystem, AtlasA
}

typeRegistry.addIndexFieldName(attribute.getVertexPropertyName(), indexFieldName);

LOG.info("Property {} is mapped to index field name {}", attribute.getQualifiedName(), attribute.getIndexFieldName());
if (LOG.isDebugEnabled()){
LOG.info("Property {} is mapped to index field name {}", attribute.getQualifiedName(), attribute.getIndexFieldName());
}
} else {
LOG.warn("resolveIndexFieldName(attribute={}): propertyKey is null for vertextPropertyName={}", attribute.getQualifiedName(), attribute.getVertexPropertyName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

@Component
@Order(9)
Expand Down Expand Up @@ -101,6 +105,8 @@ private void loadPoliciesInFolder (File folder) {

String policiesDirName = folder.getName();
File[] policyFiles = folder.exists() ? folder.listFiles() : null;
List<File> fileList= new ArrayList<>(0);


if (ArrayUtils.isNotEmpty(policyFiles)) {
Arrays.sort(policyFiles);
Expand All @@ -109,9 +115,17 @@ private void loadPoliciesInFolder (File folder) {
if (!item.isFile()) {
loadPoliciesInFolder(item);
} else {
loadPoliciesInFile(item);
//loadPoliciesInFile(item);
fileList.add(item);
}
}

// loadPoliciesInFile in async
List<CompletableFuture<Void>> futures = fileList.stream()
.map(file -> CompletableFuture.runAsync(() -> loadPoliciesInFile(file)))
.collect(Collectors.toList());

CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
} else {
LOG.warn("No policies for Bootstrapping in directory {}..", policiesDirName);
}
Expand Down

0 comments on commit 6b7d1fb

Please sign in to comment.