Skip to content

Commit 8ecc4a4

Browse files
author
Kartik Raj
authored
Get directories for global watching only if in global watching experiment (microsoft#15871)
1 parent d42fb5b commit 8ecc4a4

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/client/pythonEnvironments/base/locators/lowLevel/fsWatchingLocator.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ export abstract class FSWatchingLocator extends LazyResourceBasedLocator {
8787
}
8888

8989
protected async initWatchers(): Promise<void> {
90+
// Enable all workspace watchers.
91+
if (this.watcherKind === FSWatcherKind.Global) {
92+
// Enable global watchers only if the experiment allows it.
93+
const enableGlobalWatchers = await inExperiment(DiscoveryVariants.discoverWithFileWatching);
94+
if (!enableGlobalWatchers) {
95+
return;
96+
}
97+
}
98+
9099
// Start the FS watchers.
91100
let roots = await this.getRoots();
92101
if (typeof roots === 'string') {
@@ -104,15 +113,6 @@ export abstract class FSWatchingLocator extends LazyResourceBasedLocator {
104113
});
105114
const watchableRoots = (await Promise.all(promises)).filter((root) => !!root) as string[];
106115

107-
// Enable all workspace watchers.
108-
if (this.watcherKind === FSWatcherKind.Global) {
109-
// Enable global watchers only if the experiment allows it.
110-
const enableGlobalWatchers = await inExperiment(DiscoveryVariants.discoverWithFileWatching);
111-
if (!enableGlobalWatchers) {
112-
return;
113-
}
114-
}
115-
116116
watchableRoots.forEach((root) => this.startWatchers(root));
117117
}
118118

0 commit comments

Comments
 (0)