mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-49622 Refresh packages asynchronously inside Jupyter package-related inspections.
(cherry picked from commit 68e3eeb303e2e03f6826bdfd9eef4d67080913a3) IJ-MR-11894 GitOrigin-RevId: 080b83887ea604d88047a3bce668df99910f4206
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4839dc7366
commit
da7f965b5a
@@ -295,6 +295,19 @@ public class PythonSdkUpdater implements StartupActivity.Background {
|
||||
scheduleUpdate(sdk, project, new PyUpdateSdkRequestData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the same that {@link #scheduleUpdate(Sdk, Project)}, but simply omits the new update request if another one is in progress,
|
||||
* while the former method will schedule the next update after processing the other update.
|
||||
*/
|
||||
public static void ensureUpdateScheduled(@NotNull Sdk sdk, @NotNull Project project) {
|
||||
final String key = PythonSdkType.getSdkKey(sdk);
|
||||
synchronized (ourLock) {
|
||||
if (ourUnderRefresh.contains(key) || ourToBeRefreshed.containsKey(key)) return;
|
||||
ourUnderRefresh.add(key);
|
||||
}
|
||||
ProgressManager.getInstance().run(new PyUpdateSdkTask(project, key, new PyUpdateSdkRequestData()));
|
||||
}
|
||||
|
||||
private static void scheduleUpdate(@NotNull Sdk sdk, @NotNull Project project, @NotNull PyUpdateSdkRequestData requestData) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
LOG.info("Skipping background update for '" + sdk + "' in unit test mode");
|
||||
|
||||
Reference in New Issue
Block a user