Skip to content

Commit 165eef6

Browse files
committed
Retry multiple times
1 parent cae3530 commit 165eef6

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/vscodeLauncher.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ export async function prepareVSCodeAndExecuteTests(
6969

7070
async function installExtensions(extensionIds: string[], vscodeCli: string, vscodeArgs: string[]): Promise<void> {
7171
for (const extensionId of extensionIds) {
72-
try {
73-
await installExtension(extensionId, vscodeCli, vscodeArgs);
74-
} catch (error) {
75-
console.warn(`Failed to install extension; retrying ${extensionId}: ${error}`);
76-
// Workaround for https://github.com/microsoft/vscode/issues/256031 to install extensions one at a time with a delay.
77-
await new Promise((resolve) => setTimeout(resolve, 2000));
78-
await installExtension(extensionId, vscodeCli, vscodeArgs);
72+
// Workaround for https://github.com/microsoft/vscode/issues/256031 to retry installing the extension with a delay.
73+
for (let attempts = 0; attempts < 5; attempts++) {
74+
try {
75+
await installExtension(extensionId, vscodeCli, vscodeArgs);
76+
return;
77+
} catch (error) {
78+
console.warn(`Failed to install extension ${extensionId}; retrying: ${error}`);
79+
await new Promise((resolve) => setTimeout(resolve, 2000));
80+
}
7981
}
8082
}
8183

0 commit comments

Comments
 (0)