Skip to content

Commit d25ed3c

Browse files
author
Bhargava Varadharajan
committed
fix(smus): Fix potential race condition bug on getting context
**Description** We were seeing intermittent issues where sometimes the context was being returned as undefined. Setting it at the start of the activation to ensure the the context is available always. **Motivation** Bug fix **Testing Done** Tested manually locally.
1 parent 0401a71 commit d25ed3c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/core/src/sagemakerunifiedstudio/activation.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@ import { activate as activateConnectionMagicsSelector } from './connectionMagics
88
import { activate as activateExplorer } from './explorer/activation'
99
import { isSageMaker } from '../shared/extensionUtilities'
1010
import { initializeResourceMetadata } from './shared/utils/resourceMetadataUtils'
11+
import { setContext } from '../shared/vscode/setContext'
12+
import { SmusUtils } from './shared/smusUtils'
1113

1214
export async function activate(extensionContext: vscode.ExtensionContext): Promise<void> {
1315
// Only run when environment is a SageMaker Unified Studio space
1416
if (isSageMaker('SMUS') || isSageMaker('SMUS-SPACE-REMOTE-ACCESS')) {
1517
await initializeResourceMetadata()
18+
// Setting context before any getContext calls to avoid potential race conditions.
19+
await setContext('aws.smus.inSmusSpaceEnvironment', SmusUtils.isInSmusSpaceEnvironment())
1620
await activateConnectionMagicsSelector(extensionContext)
1721
}
1822
await activateExplorer(extensionContext)

0 commit comments

Comments
 (0)