mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[CI] Fix axios requests to allow retry (#182386)
## Summary Related to #181733 - I didn't check, and axios rejects requests' promises that don't result in `2xx`. This PR wraps the attempt in a try-catch to be able to retry.
This commit is contained in:
parent
af580c9f92
commit
389025e814
1 changed files with 16 additions and 8 deletions
|
@ -46,14 +46,22 @@ async function main() {
|
|||
|
||||
async function headAssetUrl(assetPath: string) {
|
||||
const testUrl = `${CDN_URL_PREFIX}/${assetPath}`;
|
||||
const response = await axios.head(testUrl, {
|
||||
timeout: 1000,
|
||||
});
|
||||
return {
|
||||
status: response.status,
|
||||
testUrl,
|
||||
assetPath,
|
||||
};
|
||||
try {
|
||||
const response = await axios.head(testUrl, {
|
||||
timeout: 1000,
|
||||
});
|
||||
return {
|
||||
status: response.status,
|
||||
testUrl,
|
||||
assetPath,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
status: error.response?.status || 0,
|
||||
testUrl,
|
||||
assetPath,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function headAssetUrlWithRetry(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue