Skip to content

Commit c54bd05

Browse files
committed
use single Statistics instance when reporting file collection
1 parent 3372675 commit c54bd05

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -769,27 +769,26 @@ private void processTrailingTerms(String startUid, boolean usedHistory, IndexDow
769769
*/
770770
@VisibleForTesting
771771
boolean getIndexDownArgs(String dir, File sourceRoot, IndexDownArgs args) throws IOException {
772-
Statistics elapsed = new Statistics();
773-
boolean usedHistory = false;
774-
775772
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
773+
boolean historyBased = isReadyForHistoryBasedReindex();
776774

777-
if (isReadyForHistoryBasedReindex()) {
778-
LOGGER.log(Level.INFO, "Starting file collection using history traversal for directory {0}", dir);
775+
if (LOGGER.isLoggable(Level.INFO)) {
776+
LOGGER.log(Level.INFO, String.format("Starting file collection using %s traversal for directory '%s'",
777+
historyBased ? "history" : "file-system", dir));
778+
}
779+
Statistics elapsed = new Statistics();
780+
if (historyBased) {
779781
indexDownUsingHistory(env.getSourceRootFile(), args);
780-
usedHistory = true;
781-
elapsed.report(LOGGER, String.format("Done file collection for directory %s", dir),
782-
"indexer.db.directory.collection");
783782
} else {
784-
LOGGER.log(Level.INFO, "Starting file collection using file-system traversal of directory {0}", dir);
785783
indexDown(sourceRoot, dir, args);
786-
elapsed.report(LOGGER, String.format("Done traversal of directory %s", dir),
787-
"indexer.db.directory.traversal");
788784
}
789785

786+
elapsed.report(LOGGER, String.format("Done file collection for directory '%s'", dir),
787+
"indexer.db.collection");
788+
790789
showFileCount(dir, args);
791790

792-
return usedHistory;
791+
return historyBased;
793792
}
794793

795794
/**

0 commit comments

Comments
 (0)