Skip to content

Commit d7fe660

Browse files
committed
Don't ping persistent storage for every initialize
1 parent 87efe9b commit d7fe660

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/client/pythonEnvironments/base/envsCache.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,20 @@ export interface IEnvsCache {
5151
export type CompleteEnvInfoFunction = (envInfo: PythonEnvInfo) => boolean;
5252

5353
export class PythonEnvInfoCache implements IEnvsCache {
54+
private initialized = false;
55+
5456
private envsList: PythonEnvInfo[] | undefined;
5557

5658
private persistentStorage: IPersistentState<PythonEnvInfo[]> | undefined;
5759

5860
constructor(private readonly isComplete: CompleteEnvInfoFunction) {}
5961

6062
public initialize(): void {
63+
if (this.initialized) {
64+
return;
65+
}
66+
67+
this.initialized = true;
6168
this.persistentStorage = createGlobalPersistentStore<PythonEnvInfo[]>('PYTHON_ENV_INFO_CACHE');
6269
this.envsList = this.persistentStorage?.value;
6370
}

0 commit comments

Comments
 (0)