summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2016-03-18 15:46:28 -0700
committerAlex Early <alexander.early@gmail.com>2016-03-18 15:46:28 -0700
commitbdf4a96113d93f005c8fc488f42ecfb884f48fce (patch)
treebb828869988a37cb7d4f1eb90a366b6540303d94 /README.md
parent902eec8ec2911cdd787477382b0b07123afe7d2b (diff)
parent7980923b12ee288243bc922525f70b07c3a41872 (diff)
downloadasync-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.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1ce2fd2..5c932d1 100644
--- a/README.md
+++ b/README.md
@@ -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>