Skip to content

Commit

Permalink
feat: call destory on all cached clients on deactivation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Feb 24, 2025
1 parent 6fdfdc0 commit f44f714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/extensionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export async function activate(context: vscode.ExtensionContext) {
export async function deactivate() {
// Run concurrently to speed up execution. stop() does not throw so it is safe
await Promise.all([await (await CrashMonitoring.instance())?.shutdown(), deactivateCommon(), deactivateEc2()])
globals.sdkClientBuilderV3.clearServiceCache()
await globals.resourceManager.dispose()
}

Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/shared/awsClientBuilderV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ export class AWSClientBuilderV3 {
service.middlewareStack.add(getEndpointMiddleware(serviceOptions.settings), { step: 'build' })
return service
}

public clearServiceCache() {
for (const client of this.serviceCache.values()) {
client.destroy()
}
this.serviceCache.clear()
}
}

export function getServiceId(context: { clientName?: string; commandName?: string }): string {
Expand Down

0 comments on commit f44f714

Please sign in to comment.