Skip to content

Commit

Permalink
Attempt to fix download failure. (#2931)
Browse files Browse the repository at this point in the history
* Retry vsix download with http.proxySupport "off".
  • Loading branch information
sean-mcmanus authored Dec 17, 2018
1 parent 968e0d2 commit 4b22333
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,33 @@ async function checkAndApplyUpdate(updateChannel: string): Promise<void> {
// then the .catch call will return a resolved promise
// Thusly, the .catch call must also throw, as a return would simply return an unused promise
// instead of returning early from this function scope
let config: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration();
let originalProxySupport: string = config.inspect<string>('http.proxySupport').globalValue;
while (true) { // Might need to try again with a different http.proxySupport setting.
try {
await util.downloadFileToDestination(buildInfo.downloadUrl, vsixPath);
} catch {
// Try again with the proxySupport to "off".
if (originalProxySupport !== config.inspect<string>('http.proxySupport').globalValue) {
config.update('http.proxySupport', originalProxySupport, true); // Reset the http.proxySupport.
reject(new Error('Failed to download VSIX package with proxySupport off')); // Changing the proxySupport didn't help.
return;
}
if (config.get('http.proxySupport') !== "off" && originalProxySupport !== "off") {
config.update('http.proxySupport', "off", true);
continue;
}
reject(new Error('Failed to download VSIX package'));
return;
}
if (originalProxySupport !== config.inspect<string>('http.proxySupport').globalValue) {
config.update('http.proxySupport', originalProxySupport, true); // Reset the http.proxySupport.
telemetry.logLanguageServerEvent('installVsix', { 'error': "Success with proxySupport off", 'success': 'true' });
}
break;
}
try {
await util.downloadFileToDestination(buildInfo.downloadUrl, vsixPath)
.catch(() => { throw new Error('Failed to download VSIX package'); });
await installVsix(vsixPath, updateChannel)
.catch((error: Error) => { throw error; });
await installVsix(vsixPath, updateChannel);
} catch (error) {
reject(error);
return;
Expand Down

0 comments on commit 4b22333

Please sign in to comment.