builder-util
Advanced tools
Comparing version 25.0.0-alpha.3 to 25.0.0-alpha.4
@@ -42,2 +42,2 @@ /// <reference types="node" /> | ||
export declare function executeAppBuilder(args: Array<string>, childProcessConsumer?: (childProcess: ChildProcess) => void, extraOptions?: SpawnOptions, maxRetries?: number): Promise<string>; | ||
export declare function retry<T>(task: () => Promise<T>, retriesLeft: number, interval: number, backoff?: number, attempt?: number): Promise<T>; | ||
export declare function retry<T>(task: () => Promise<T>, retryCount: number, interval: number, backoff?: number, attempt?: number, shouldRetry?: (e: any) => boolean): Promise<T>; |
@@ -372,3 +372,4 @@ "use strict"; | ||
exports.executeAppBuilder = executeAppBuilder; | ||
async function retry(task, retriesLeft, interval, backoff = 0, attempt = 0) { | ||
async function retry(task, retryCount, interval, backoff = 0, attempt = 0, shouldRetry) { | ||
var _a; | ||
try { | ||
@@ -378,6 +379,6 @@ return await task(); | ||
catch (error) { | ||
log_1.log.info(`Above command failed, retrying ${retriesLeft} more times`); | ||
if (retriesLeft > 0) { | ||
log_1.log.info(`Above command failed, retrying ${retryCount} more times`); | ||
if (((_a = shouldRetry === null || shouldRetry === void 0 ? void 0 : shouldRetry(error)) !== null && _a !== void 0 ? _a : true) && retryCount > 0) { | ||
await new Promise(resolve => setTimeout(resolve, interval + backoff * attempt)); | ||
return await retry(task, retriesLeft - 1, interval, backoff, attempt + 1); | ||
return await retry(task, retryCount - 1, interval, backoff, attempt + 1, shouldRetry); | ||
} | ||
@@ -384,0 +385,0 @@ else { |
{ | ||
"name": "builder-util", | ||
"version": "25.0.0-alpha.3", | ||
"version": "25.0.0-alpha.4", | ||
"main": "out/util.js", | ||
@@ -5,0 +5,0 @@ "author": "Vladimir Krivosheev", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131335
1328