Skip to content

Commit

Permalink
Fix combining iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed May 12, 2022
1 parent 4f32c50 commit b1ea20a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/client/pythonEnvironments/base/locators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ export function combineIterators<I>(iterators: IPythonEnvsIterator<I>[]): IPytho
const disposable = event!((e: PythonEnvUpdatedEvent<I> | ProgressNotificationEvent) => {
// NOSONAR
if (isProgressEvent(e)) {
if (e.stage !== ProgressReportStage.discoveryFinished) {
return;
}
numActive -= 1;
if (numActive === 0) {
// All the sub-events are done so we're done.
handleEvent({ stage: ProgressReportStage.discoveryFinished });
if (e.stage === ProgressReportStage.discoveryFinished) {
numActive -= 1;
if (numActive === 0) {
// All the sub-events are done so we're done.
handleEvent({ stage: ProgressReportStage.discoveryFinished });
}
} else {
handleEvent({ stage: e.stage });
}
} else {
handleEvent(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
private createProgressStates(query: PythonLocatorQuery | undefined) {
this.refreshDeferreds.set(query, createDeferred<void>());
Object.values(ProgressReportStage).forEach((stage) => {
const deferred = createDeferred<void>();
this.refreshStageDeferreds.set(stage, deferred);
this.refreshStageDeferreds.set(stage, createDeferred<void>());
});
if (ProgressReportStage.allPathsDiscovered && query) {
// This stage is only applicable when no scope is provided.
// Only mark as all paths discovered when querying for all envs.
this.refreshStageDeferreds.delete(ProgressReportStage.allPathsDiscovered);
}
}
Expand Down

0 comments on commit b1ea20a

Please sign in to comment.