Postpone (invokeLater) stopProcess to allow myUpdateRunnableFuture to finish

`stopProcess` checks whether the future is finished before scheduling a new task to avoid many re-schedules.

However, in this case, the future will never be in finished state, because `stopProcess` is called from the inside of it.
So, the analyzer will never schedule a new task here.

To allow the future to finish before `stopProcess` is called, we can postpone its execution by using `invokeLater`. By the time `stopProcess` is executed, this future is going to finish, so the check can succeed.

Fixes rare issue in RDCT-933 when analyzer doesn't finish editor analysing.

GitOrigin-RevId: 5ecb914ce2b3c792988853955fcb9a03d6fc9129
This commit is contained in:
Kate Botsman
2024-03-27 14:18:48 +00:00
committed by intellij-monorepo-bot
parent 6f9879332b
commit 3caa4aaa24
@@ -1100,7 +1100,9 @@ public final class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx
}
if (!submitted) {
// happens e.g., when we are trying to open a directory and there's a FileEditor supporting this
dca.stopProcess(true, "Couldn't create session for "+activeEditors);
ApplicationManager.getApplication().invokeLater(() -> {
dca.stopProcess(true, "Couldn't create session for " + activeEditors);
});
}
}
catch (ProcessCanceledException ignored) {