Skip to content

Commit

Permalink
fix: reduced span of ReadAction to avoid possible deadlock (#944) (#962)
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish authored Jan 31, 2025
1 parent 2474d44 commit fbac285
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public void setLogged(boolean logged) {
private CompletableFuture<ApplicationRootNodeOdo> doGetOdo() {
if (odoFuture == null) {
this.odoFuture =
ReadAction.compute(() -> ToolFactory.getInstance()
ToolFactory.getInstance()
.createOdo(getClient(), project)
.thenApply(tool -> {
ApplicationRootNodeOdo odo = new ApplicationRootNodeOdo(tool.get(), tool.isDownloaded(), this, processHelper);
loadProjectModel(odo, project);
return odo;
}));
});
}
return odoFuture;
}
Expand Down Expand Up @@ -175,9 +175,11 @@ protected void loadProjectModel(OdoFacade odo, Project project) {
if (odo == null) {
return;
}
for (Module module : ModuleManager.getInstance(project).getModules()) {
addContext(odo, ProjectUtils.getModuleRoot(module));
}
ReadAction.run(() -> {
for (Module module : ModuleManager.getInstance(project).getModules()) {
addContext(odo, ProjectUtils.getModuleRoot(module));
}
});
}

@Override
Expand Down

0 comments on commit fbac285

Please sign in to comment.