Skip to content

Commit be9e460

Browse files
nturinskiNathan Turinski
andauthored
Performance improvements made by copilot (#4923)
Co-authored-by: Nathan Turinski <naturins@microsoft.comm>
1 parent 7f54a6a commit be9e460

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/commands/createNewProject/mcpServerSteps/MCPDownloadSnippetsExecuteStep.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export class MCPDownloadSnippetsExecuteStep extends AzureWizardExecuteStepWithAc
3939
}
4040

4141
private async downloadFilesRecursively(context: MCPProjectWizardContext, items: GitHubFileMetadata[], basePath: string): Promise<void> {
42-
for (const item of items) {
42+
// Download all files and directories at this level in parallel
43+
await Promise.all(items.map(async (item) => {
4344
if (item.type === 'file') {
4445
await MCPDownloadSnippetsExecuteStep.downloadSingleFile({
4546
context, item,
@@ -59,7 +60,7 @@ export class MCPDownloadSnippetsExecuteStep extends AzureWizardExecuteStepWithAc
5960
// Recursively download directory contents
6061
await this.downloadFilesRecursively(context, dirContents, dirPath);
6162
}
62-
}
63+
}));
6364
}
6465

6566
public shouldExecute(context: MCPProjectWizardContext): boolean {

src/commands/deploy/deploy.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { type Site, type SiteConfigResource, type StringDictionary } from '@azure/arm-appservice';
6+
import { type Site, type SiteConfigResource } from '@azure/arm-appservice';
77
import { getDeployFsPath, getDeployNode, deploy as innerDeploy, showDeployConfirmation, type IDeployContext, type IDeployPaths, type InnerDeployContext, type ParsedSite } from '@microsoft/vscode-azext-azureappservice';
88
import { ResourceGroupListStep } from '@microsoft/vscode-azext-azureutils';
99
import { AzureWizard, DialogResponses, subscriptionExperience, type ExecuteActivityContext, type IActionContext, type ISubscriptionContext } from '@microsoft/vscode-azext-utils';
@@ -133,8 +133,11 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
133133
void showCoreToolsWarning(context, version, site.fullName);
134134

135135
const client = await site.createClient(actionContext);
136-
const siteConfig: SiteConfigResource = await client.getSiteConfig();
137-
const isConsumption: boolean = await client.getIsConsumption(actionContext);
136+
// Parallelize independent read-only calls: site config and consumption check
137+
const [siteConfig, isConsumption] = await Promise.all([
138+
client.getSiteConfig(),
139+
client.getIsConsumption(actionContext),
140+
]);
138141
let isZipDeploy: boolean = siteConfig.scmType !== ScmType.LocalGit && siteConfig.scmType !== ScmType.GitHub;
139142
if (!isZipDeploy && site.isLinux && isConsumption) {
140143
ext.outputChannel.appendLog(localize('linuxConsZipOnly', 'WARNING: Using zip deploy because scm type "{0}" is not supported on Linux consumption', siteConfig.scmType), { resourceName: site.fullName });
@@ -167,9 +170,11 @@ async function deploy(actionContext: IActionContext, arg1: vscode.Uri | string |
167170
context.deployMethod = 'flexconsumption';
168171
}
169172

170-
const appSettings: StringDictionary = await client.listApplicationSettings();
171-
172-
const durableStorageType: DurableBackend | undefined = await durableUtils.getStorageTypeFromWorkspace(language, context.projectPath);
173+
// Parallelize remote app settings fetch and local workspace durable storage detection
174+
const [appSettings, durableStorageType] = await Promise.all([
175+
client.listApplicationSettings(),
176+
durableUtils.getStorageTypeFromWorkspace(language, context.projectPath),
177+
]);
173178
context.telemetry.properties.durableStorageType = durableStorageType;
174179

175180
if (durableStorageType === DurableBackend.SQL && isFlexConsumption) {

0 commit comments

Comments
 (0)