Skip to content

Commit a537581

Browse files
committed
Lock-free part for ActionSafeReadLock updates
1 parent 877bc14 commit a537581

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎python-impl/src/main/java/com/jetbrains/python/impl/packaging/setupPy/CreateSetupPyAction.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public FileTemplate getTemplate() {
6868
@Override
6969
public Coroutine<?, ?> updateAsync(AnActionEvent e) {
7070
return ActionSafeReadLock.run(e, presentation -> {
71+
// nothing to decide without the lock: the module is computed lazily (the visibility is never changed)
72+
presentation.setEnabled(true);
73+
}, presentation -> {
7174
Module module = e.getData(Module.KEY);
7275
e.getPresentation().setEnabled(module != null && PyPackageUtil.findSetupPy(module) == null);
7376
}).toCoroutine();

‎python-rest/src/main/java/com/jetbrains/python/rest/sphinx/RunSphinxQuickStartAction.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public RunSphinxQuickStartAction() {
4242
@Override
4343
public Coroutine<?, ?> updateAsync(AnActionEvent e) {
4444
return ActionSafeReadLock.run(e, presentation -> {
45+
// nothing to decide without the lock: only the python sdk of the lazily computed module can disable the action
46+
presentation.setEnabled(true);
47+
}, presentation -> {
4548
RestPythonUtil.updateSphinxQuickStartRequiredAction(e);
4649
}).toCoroutine();
4750
}

0 commit comments

Comments
 (0)