From a4813ffc1850a3c3459ec444ebede47b40ed8743 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Fri, 11 Apr 2025 20:16:13 +0200 Subject: [PATCH] [plugins] IJPL-183064 Plugins: infinite loading of advertiser suggestions breaks editor notifications GitOrigin-RevId: 7da131ac3357e39622e9a931f2a89ffba6c620b0 --- .../updateSettings/impl/pluginsAdvertisement/State.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/State.kt b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/State.kt index 2ef0732083a4..22640ad160c2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/State.kt +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/pluginsAdvertisement/State.kt @@ -144,6 +144,8 @@ class PluginAdvertiserExtensionsStateService : SettingsSavingComponent { updateCache(extensionOrFileName, compatiblePlugins) + LOG.debug("Found compatible plugins for files '$extensionOrFileName': ${compatiblePlugins.joinToString { it.pluginIdString }}") + return@withContext true } } @@ -162,10 +164,10 @@ class PluginAdvertiserExtensionsStateService : SettingsSavingComponent { var refreshedCompatiblePlugins = false for (h in fileHandlerDetectors) { - if (!force && cache.getIfPresent(h.id) != null) continue // already filled cache in this session - val implementationName = "${FILE_HANDLER_KIND}:${h.id}" + if (!force && cache.getIfPresent(implementationName) != null) continue // already filled cache in this session + // if network fails we will have empty results here and do not ask again for the same file cache.put(implementationName, PluginAdvertisedByFileContent(h, emptySet())) @@ -173,6 +175,8 @@ class PluginAdvertiserExtensionsStateService : SettingsSavingComponent { val compatiblePlugins = requestCompatiblePlugins(implementationName, knownDependencies.get(implementationName)) cache.put(implementationName, PluginAdvertisedByFileContent(h, compatiblePlugins)) + LOG.debug("Found compatible handlers '${h.id}': ${compatiblePlugins.joinToString { it.pluginIdString }}") + refreshedCompatiblePlugins = true } } @@ -216,7 +220,7 @@ class PluginAdvertiserExtensionsStateService : SettingsSavingComponent { if (!UnknownFeaturesCollector.getInstance(project).isIgnored(unknownFeature)) { val fromCache = (cache.getIfPresent(implementationName) as? PluginAdvertisedByFileContent)?.plugins - if (fromCache == null) return null // no compatible plugins info yet, need round-trip to Marketplace + if (fromCache == null) return null // no compatible plugins info yet, need a round-trip to Marketplace val compatibleOnlyPlugins = fromCache.map { it.pluginIdString }