Skip to content

Commit 65094df

Browse files
author
Kartik Raj
committed
Change worker to return interpreter information instead
1 parent d2a59dc commit 65094df

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/client/pythonEnvironments/info/environmentInfoService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export enum EnvironmentInfoServiceQueuePriority {
1616
export const IEnvironmentInfoService = Symbol('IEnvironmentInfoService');
1717
export interface IEnvironmentInfoService {
1818
getEnvironmentInfo(
19-
environment: PythonEnvInfo,
19+
interpreterPath: string,
2020
priority?: EnvironmentInfoServiceQueuePriority
2121
): Promise<InterpreterInformation | undefined>;
2222
}
@@ -49,7 +49,7 @@ export class EnvironmentInfoService implements IEnvironmentInfoService {
4949
}
5050

5151
public async getEnvironmentInfo(
52-
environment: PythonEnvInfo,
52+
interpreterPath: string,
5353
priority?: EnvironmentInfoServiceQueuePriority,
5454
): Promise<InterpreterInformation | undefined> {
5555
const result = this.cache.get(interpreterPath);
@@ -60,8 +60,8 @@ export class EnvironmentInfoService implements IEnvironmentInfoService {
6060
const deferred = createDeferred<InterpreterInformation>();
6161
this.cache.set(interpreterPath, deferred);
6262
return (priority === EnvironmentInfoServiceQueuePriority.High
63-
? this.workerPool.addToQueue(environment, QueuePosition.Front)
64-
: this.workerPool.addToQueue(environment, QueuePosition.Back)
63+
? this.workerPool.addToQueue(interpreterPath, QueuePosition.Front)
64+
: this.workerPool.addToQueue(interpreterPath, QueuePosition.Back)
6565
).then((r) => {
6666
deferred.resolve(r);
6767
if (r === undefined) {

src/test/pythonEnvironments/info/environmentInfoService.functional.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ suite('Environment Info Service', () => {
5454
for (let i = 0; i < 10; i = i + 1) {
5555
const path = `any-path${i}`;
5656
if (i < 5) {
57-
promises.push(envService.getEnvironmentInfo(createEnvInfo(path)));
57+
promises.push(envService.getEnvironmentInfo(path));
5858
} else {
59-
promises.push(
60-
envService.getEnvironmentInfo(createEnvInfo(path), EnvironmentInfoServiceQueuePriority.High),
61-
);
59+
promises.push(envService.getEnvironmentInfo(path, EnvironmentInfoServiceQueuePriority.High));
6260
}
6361
expected.push(createExpectedEnvInfo(path));
6462
}
@@ -81,10 +79,10 @@ suite('Environment Info Service', () => {
8179
// Clear call counts
8280
stubShellExec.resetHistory();
8381
// Evaluate once so the result is cached.
84-
await envService.getEnvironmentInfo(createEnvInfo(path));
82+
await envService.getEnvironmentInfo(path);
8583

8684
for (let i = 0; i < 10; i = i + 1) {
87-
promises.push(envService.getEnvironmentInfo(createEnvInfo(path)));
85+
promises.push(envService.getEnvironmentInfo(path));
8886
expected.push(createExpectedEnvInfo(path));
8987
}
9088

0 commit comments

Comments
 (0)