Enable multithreaded indexing in unit tests (and other headless environments)

GitOrigin-RevId: c06beda02d20e8b8f9f0cb8eb7c8d3f0910c8ebc
This commit is contained in:
Andrei.Kuznetsov
2024-03-27 20:03:09 +00:00
committed by intellij-monorepo-bot
parent 50b2c6aedd
commit 976d4b6edf
@@ -382,7 +382,14 @@ public final class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesU
public static void invokeConcurrentlyIfPossible(@NotNull List<? extends Runnable> tasks) {
if (tasks.isEmpty()) return;
if (tasks.size() == 1 || ApplicationManager.getApplication().isWriteAccessAllowed() || DumbServiceImpl.isSynchronousTaskExecution()) {
boolean synchronous = (tasks.size() == 1);
if (DumbServiceImpl.isSynchronousTaskExecution()) {
synchronous = true;
}
else {
LOG.assertTrue(!ApplicationManager.getApplication().isWriteAccessAllowed(), "Write access is not allowed");
}
if (synchronous) {
for (Runnable r : tasks) r.run();
return;
}