diff options
author | Alex Early <alexander.early@gmail.com> | 2016-03-18 15:46:28 -0700 |
---|---|---|
committer | Alex Early <alexander.early@gmail.com> | 2016-03-18 15:46:28 -0700 |
commit | bdf4a96113d93f005c8fc488f42ecfb884f48fce (patch) | |
tree | bb828869988a37cb7d4f1eb90a366b6540303d94 /README.md | |
parent | 902eec8ec2911cdd787477382b0b07123afe7d2b (diff) | |
parent | 7980923b12ee288243bc922525f70b07c3a41872 (diff) | |
download | async-bdf4a96113d93f005c8fc488f42ecfb884f48fce.tar.gz |
Merge pull request #1058 from caolan/retryable
added retryable wrapper for async tasks
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -221,6 +221,7 @@ Some functions are also available in the following forms: * [`auto`](#auto) * [`autoInject`](#autoInject) * [`retry`](#retry) +* [`retryable`](#retryable) * [`iterator`](#iterator) * [`times`](#times), `timesSeries`, `timesLimit` * [`race`](#race) @@ -1580,6 +1581,31 @@ async.auto({ }); ``` + +--------------------------------------- + +<a name="retryable"></a> + +### retryable([opts = {times: 5, interval: 0}| 5], task) + +A close relative of `retry`. This method wraps a task and makes it retryable, rather than immediately calling it with retries. + +__Arguments__ + +* `opts` - optional options, exactly the same as from `retry` +* `task` - the asynchronous function to wrap + +__Example__ + +```js +async.auto({ + dep1: async.retryable(3, getFromFlakyService), + process: ["dep1", async.retryable(3, function (results, cb) { + maybeProcessData(results.dep1, cb) + })] +}, callback) +``` + --------------------------------------- <a name="iterator"></a> |