From c86c03e89341b05465c09946ff45bb46dade8870 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Thu, 1 Feb 2024 17:42:29 +0000 Subject: [PATCH] Add comments --- .../pythonEnvironments/base/locators/composite/envsReducer.ts | 3 ++- .../pythonEnvironments/base/locators/composite/envsResolver.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/pythonEnvironments/base/locators/composite/envsReducer.ts b/src/client/pythonEnvironments/base/locators/composite/envsReducer.ts index 1c3fa3e8336b..8a342a0386ef 100644 --- a/src/client/pythonEnvironments/base/locators/composite/envsReducer.ts +++ b/src/client/pythonEnvironments/base/locators/composite/envsReducer.ts @@ -55,6 +55,8 @@ async function* iterEnvsIterator( if (isProgressEvent(event)) { if (event.stage === ProgressReportStage.discoveryFinished) { state.done = true; + // For super slow locators such as Windows registry, we expect updates even after discovery + // is "officially" finished, hence do not dispose listeners. // listener.dispose(); } else { didUpdate.fire(event); @@ -122,7 +124,6 @@ function checkIfFinishedAndNotify( ) { if (state.done && state.pending === 0) { didUpdate.fire({ stage: ProgressReportStage.discoveryFinished }); - // didUpdate.dispose(); traceVerbose(`Finished with environment reducer`); state.done = false; // No need to notify again. } diff --git a/src/client/pythonEnvironments/base/locators/composite/envsResolver.ts b/src/client/pythonEnvironments/base/locators/composite/envsResolver.ts index ad8af59883da..752f5778c73c 100644 --- a/src/client/pythonEnvironments/base/locators/composite/envsResolver.ts +++ b/src/client/pythonEnvironments/base/locators/composite/envsResolver.ts @@ -87,6 +87,8 @@ export class PythonEnvsResolver implements IResolvingLocator { if (event.stage === ProgressReportStage.discoveryFinished) { didUpdate.fire({ stage: ProgressReportStage.allPathsDiscovered }); state.done = true; + // For super slow locators such as Windows registry, we expect updates even after discovery + // is "officially" finished, hence do not dispose listeners. // listener.dispose(); } else { didUpdate.fire(event); @@ -172,7 +174,6 @@ function checkIfFinishedAndNotify( ) { if (state.done && state.pending === 0) { didUpdate.fire({ stage: ProgressReportStage.discoveryFinished }); - // didUpdate.dispose(); traceVerbose(`Finished with environment resolver`); } }