Skip to content

Commit e2750b0

Browse files
committed
lightspeed: avoid a race condition
- refresh the settings first before refreshing the webviews. - also, ensure lightspeed is enabled before firing a view refresh
1 parent 25f26d4 commit e2750b0

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/extension.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
289289
if (!editor) {
290290
await ignorePendingSuggestion();
291291
}
292+
if (!extSettings.settings.lightSpeedService.enabled) {
293+
return;
294+
}
292295
lightSpeedManager.lightspeedExplorerProvider.refreshWebView();
293296
},
294297
),
@@ -300,7 +303,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
300303
lightSpeedManager,
301304
pythonInterpreterManager,
302305
);
303-
lightSpeedManager.lightspeedExplorerProvider.refreshWebView();
306+
if (!extSettings.settings.lightSpeedService.enabled) {
307+
return;
308+
}
304309
metaData.sendAnsibleMetadataTelemetry();
305310
}),
306311
);
@@ -369,6 +374,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
369374
if (!lightSpeedManager.lightspeedAuthenticatedUser.isAuthenticated()) {
370375
lightSpeedManager.currentModelValue = undefined;
371376
}
377+
if (!extSettings.settings.lightSpeedService.enabled) {
378+
return;
379+
}
372380
if (lightSpeedManager.lightspeedExplorerProvider.webviewView) {
373381
lightSpeedManager.lightspeedExplorerProvider.refreshWebView();
374382
}
@@ -672,6 +680,9 @@ export async function activate(context: ExtensionContext): Promise<void> {
672680
);
673681
lightSpeedManager.lightspeedExplorerProvider.lightspeedExperimentalEnabled =
674682
true;
683+
if (!extSettings.settings.lightSpeedService.enabled) {
684+
return;
685+
}
675686
lightSpeedManager.lightspeedExplorerProvider.refreshWebView();
676687
},
677688
),

src/utils/settings.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ export async function updateConfigurationChanges(
99
extSettings: SettingsManager,
1010
lightSpeedManager: LightSpeedManager,
1111
): Promise<void> {
12+
await extSettings.reinitialize();
1213
await metaData.updateAnsibleInfoInStatusbar();
1314
await lightSpeedManager.reInitialize();
1415
await pythonInterpreter.updatePythonInfoInStatusbar();
15-
16-
await extSettings.reinitialize();
1716
}

0 commit comments

Comments
 (0)