diff --git a/async/async-tests.ts b/async/async-tests.ts index 037481b6fa..e7af9120a1 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -378,6 +378,7 @@ async.auto({ async.retry(3, function (callback, results) { }, function (err, result) { }); async.retry({ times: 3, interval: 200 }, function (callback, results) { }, function (err, result) { }); +async.retry({ times: 3, interval: (retryCount) => { return 200 * retryCount; } }, function (callback, results) { }, function (err, result) { }); async.parallel([ diff --git a/async/async.d.ts b/async/async.d.ts index 6ec52cf1e6..6288a269a1 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -136,7 +136,7 @@ interface Async { cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo; auto(tasks: any, callback?: (error: Error, results: any) => void): void; retry(opts: number, task: (callback : AsyncResultCallback, results: any) => void, callback: (error: Error, results: any) => void): void; - retry(opts: { times: number, interval: number }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; + retry(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback, results : any) => void, callback: (error: Error, results: any) => void): void; iterator(tasks: Function[]): Function; apply(fn: Function, ...arguments: any[]): AsyncFunction; nextTick(callback: Function): void;