Skip to content

Commit ee9fce7

Browse files
committed
add retry to download cli
1 parent 703ac82 commit ee9fce7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/client/AstClient.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export class AstClient {
88
* Creates a request handler with a proxy agent if the HTTP_PROXY environment variable is set.
99
* Returns `undefined` if no proxy is configured or if an error occurs while parsing the proxy URL.
1010
*/
11+
private retryInterval = 2000;
12+
private maxAttempts = 3;
1113
private createProxyRequestHandler(): any | undefined {
1214
const proxyEnv = process.env.HTTP_PROXY;
1315
if (!proxyEnv) {
@@ -60,7 +62,7 @@ export class AstClient {
6062
}
6163

6264
try {
63-
const downloadedPath = await toolLib.downloadTool(url, outputPath, requestHandlers);
65+
const downloadedPath = await toolLib.downloadToolWithRetries(url, outputPath, requestHandlers, undefined, this.maxAttempts, this.retryInterval);
6466
logger.info(`Download completed successfully. File saved to: ${downloadedPath}`);
6567
} catch (error: any) {
6668
logger.error(`Error downloading file from ${url}: ${error.message || error}`);

0 commit comments

Comments
 (0)