@microsoft/vscode-azext-azureappservice
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -19,2 +19,4 @@ "use strict"; | ||
const vscode_azext_azureutils_1 = require("@microsoft/vscode-azext-azureutils"); | ||
const vscode_azext_utils_1 = require("@microsoft/vscode-azext-utils"); | ||
const retry = require("p-retry"); | ||
const path = require("path"); | ||
@@ -74,7 +76,26 @@ const createKuduClient_1 = require("./createKuduClient"); | ||
} | ||
/* | ||
Related to issue: https://github.com/microsoft/vscode-azurefunctions/issues/3337 | ||
Sometimes receive a 'BadGateway' or 'ServiceUnavailable' error on initial fetch, but consecutive re-fetching usually fixes the issue. | ||
Under these circumstances, we will attempt to do the call 3 times during warmup before throwing the error. | ||
*/ | ||
const retries = 3; | ||
const badGateway = /BadGateway/i; | ||
const serviceUnavailable = /ServiceUnavailable/i; | ||
const client = yield (0, vscode_azext_azureutils_1.createGenericClient)(context, site.subscription); | ||
return yield client.sendRequest({ | ||
method: 'GET', | ||
url: `${site.id}/hostruntime/admin/vfs/${filePath}/?api-version=2018-11-01` | ||
}); | ||
return yield retry(() => __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
return yield client.sendRequest({ | ||
method: 'GET', | ||
url: `${site.id}/hostruntime/admin/vfs/${filePath}/?api-version=2018-11-01` | ||
}); | ||
} | ||
catch (error) { | ||
const parsedError = (0, vscode_azext_utils_1.parseError)(error); | ||
if (!(badGateway.test(parsedError.message) || serviceUnavailable.test(parsedError.message))) { | ||
throw new retry.AbortError(error); | ||
} | ||
throw error; | ||
} | ||
}), { retries, minTimeout: 10 * 1000 }); | ||
} | ||
@@ -81,0 +102,0 @@ else { |
{ | ||
"name": "@microsoft/vscode-azext-azureappservice", | ||
"author": "Microsoft Corporation", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "Common tools for developing Azure App Service extensions for VS Code", | ||
@@ -6,0 +6,0 @@ "tags": [ |
401275
7127