PY-88517 Make pythonSdkConfigurationMutex per-project to prevent cross-project notifications

The mutex was a global singleton whose isLocked StateFlow was observed by
every project's InterpreterFixExecutor. A lock state change from any
project fanned out updateAllNotifications() to all projects, triggering
stale cache refreshes with visible "Checking existing environments"
progress bars in idle projects.

Replace the global val with a per-project service so each project
observes only its own mutex state.


(cherry picked from commit cc14dce7d07231f6d7d4c3f654cdd8d3a2099ffc)

IJ-MR-197413

GitOrigin-RevId: 65753107b7fe9e654c99f7097f1f41c0499231dc
This commit is contained in:
Vitaly Legchilkin
2026-03-23 17:25:40 +00:00
committed by intellij-monorepo-bot
parent ed92591d08
commit e9f911fb1d
13 changed files with 33 additions and 21 deletions
@@ -138,7 +138,7 @@ internal class ModulesSdkConfigurator private constructor(
* Errors are logged.
*
*/
suspend fun configureSdks(modulesOnly: Set<ModuleName>) = pythonSdkConfigurationMutex.withLock {
suspend fun configureSdks(modulesOnly: Set<ModuleName>) = project.pythonSdkConfigurationMutex.withLock {
withContext(Dispatchers.Default) {
val modulesMap = project.modules.associateBy { it.name }
val modulesWithSameSdk = mutableMapOf<Module, Module>()
@@ -197,7 +197,7 @@ suspend fun configureSdkAutomatically(project: Project): Unit = withContext(Disp
when (pythonModules.size) {
0 -> return@withContext
1 -> pythonModules.first().autoConfigureSdkIfNeeded()?.orLogException(logger)
else -> pythonSdkConfigurationMutex.withLock {
else -> project.pythonSdkConfigurationMutex.withLock {
for (module in pythonModules) {
if (module.findPythonSdk() != null) continue
val sdkSuggestion = module.suggestSdk()