3 Object.defineProperty(exports, "__esModule", {
7 exports.default = function (opts, task) {
12 return (0, _initialParams2.default)(function (args, callback) {
14 task.apply(null, args.concat(cb));
17 if (opts) (0, _retry2.default)(opts, taskFn, callback);else (0, _retry2.default)(taskFn, callback);
21 var _retry = require('./retry');
23 var _retry2 = _interopRequireDefault(_retry);
25 var _initialParams = require('./internal/initialParams');
27 var _initialParams2 = _interopRequireDefault(_initialParams);
29 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31 module.exports = exports['default'];
34 * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method wraps a task and makes it
35 * retryable, rather than immediately calling it with retries.
39 * @memberOf module:ControlFlow
41 * @see [async.retry]{@link module:ControlFlow.retry}
42 * @category Control Flow
43 * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional
44 * options, exactly the same as from `retry`
45 * @param {Function} task - the asynchronous function to wrap
46 * @returns {Functions} The wrapped function, which when invoked, will retry on
47 * an error, based on the parameters specified in `opts`.
51 * dep1: async.retryable(3, getFromFlakyService),
52 * process: ["dep1", async.retryable(3, function (results, cb) {
53 * maybeProcessData(results.dep1, cb);