diff options
Diffstat (limited to 'lib/retry.js')
-rw-r--r-- | lib/retry.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/retry.js b/lib/retry.js index a5ad866..e279016 100644 --- a/lib/retry.js +++ b/lib/retry.js @@ -1,5 +1,6 @@ import noop from 'lodash/noop'; import constant from 'lodash/constant'; +import wrapAsync from './internal/wrapAsync'; /** * Attempts to get a successful response from `task` no more than `times` times @@ -124,9 +125,11 @@ export default function retry(opts, task, callback) { throw new Error("Invalid arguments for async.retry"); } + var _task = wrapAsync(task); + var attempt = 1; function retryAttempt() { - task(function(err) { + _task(function(err) { if (err && attempt++ < options.times && (typeof options.errorFilter != 'function' || options.errorFilter(err))) { |