Skip to content

Commit d7b6797

Browse files
author
Vladimir Kotal
committed
set parallelism level for repository invalidation based on configuration
fixes #3391
1 parent e2dc7a4 commit d7b6797

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryGuru.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import java.util.concurrent.ExecutorService;
4343
import java.util.concurrent.Executors;
4444
import java.util.concurrent.Future;
45-
import java.util.concurrent.ThreadFactory;
4645
import java.util.logging.Level;
4746
import java.util.logging.Logger;
4847
import java.util.stream.Collectors;
@@ -816,16 +815,12 @@ public void invalidateRepositories(Collection<? extends RepositoryInfo> repos, C
816815
* run in parallel to speed up the process.
817816
*/
818817
final CountDownLatch latch = new CountDownLatch(repos.size());
819-
final ExecutorService executor = Executors.newFixedThreadPool(
820-
Runtime.getRuntime().availableProcessors(),
821-
new ThreadFactory() {
822-
@Override
823-
public Thread newThread(Runnable runnable) {
818+
final ExecutorService executor = Executors.newFixedThreadPool(env.getIndexingParallelism(),
819+
runnable -> {
824820
Thread thread = Executors.defaultThreadFactory().newThread(runnable);
825821
thread.setName("invalidate-repos-" + thread.getId());
826822
return thread;
827-
}
828-
});
823+
});
829824

830825
for (RepositoryInfo rinfo : repos) {
831826
executor.submit(new Runnable() {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,8 @@ public static String[] parseOptions(String[] argv) throws ParseException {
757757
cfg.setWebappLAF((String) stylePath));
758758

759759
parser.on("-T", "--threads", "=number", Integer.class,
760-
"The number of threads to use for index generation and repository scan.",
760+
"The number of threads to use for index generation, repository scan",
761+
"and repository invalidation.",
761762
"By default the number of threads will be set to the number of available",
762763
"CPUs. This influences the number of spawned ctags processes as well.").
763764
execute(threadCount -> cfg.setIndexingParallelism((Integer) threadCount));

0 commit comments

Comments
 (0)