summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Early <alexander.early@gmail.com>2016-03-11 21:40:30 -0800
committerAlexander Early <alexander.early@gmail.com>2016-03-11 21:40:30 -0800
commit7980923b12ee288243bc922525f70b07c3a41872 (patch)
tree42bd494ae89d96330993ef12583263539ee15280
parentffa7b0fe282e6edd41c52d2120f44ce335ee7701 (diff)
downloadasync-retryable.tar.gz
add docs for retryableretryable
-rw-r--r--README.md26
1 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md
index 734e1aa..0416899 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>