Skip to content

Commit 766c48c

Browse files
authored
ZEIT -> Vercel. (#82)
1 parent 2b1d3fe commit 766c48c

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

LICENSE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2017 ZEIT, Inc.
3+
Copyright (c) 2021 Vercel, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
# async-retry
22

3-
[![Code Style](https://badgen.net/badge/code%20style/airbnb/fd5c63)](https://github.com/airbnb/javascript)
4-
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
5-
63
Retrying made simple, easy, and async.
74

85
## Usage
96

107
```js
118
// Packages
12-
const retry = require('async-retry')
13-
const fetch = require('node-fetch')
14-
15-
await retry(async bail => {
16-
// if anything throws, we retry
17-
const res = await fetch('https://google.com')
18-
19-
if (403 === res.status) {
20-
// don't retry upon 403
21-
bail(new Error('Unauthorized'))
22-
return
9+
const retry = require('async-retry');
10+
const fetch = require('node-fetch');
11+
12+
await retry(
13+
async (bail) => {
14+
// if anything throws, we retry
15+
const res = await fetch('https://google.com');
16+
17+
if (403 === res.status) {
18+
// don't retry upon 403
19+
bail(new Error('Unauthorized'));
20+
return;
21+
}
22+
23+
const data = await res.text();
24+
return data.substr(0, 500);
25+
},
26+
{
27+
retries: 5,
2328
}
24-
25-
const data = await res.text()
26-
return data.substr(0, 500)
27-
}, {
28-
retries: 5
29-
})
29+
);
3030
```
3131

3232
### API
@@ -40,14 +40,14 @@ retry(retrier : Function, opts : Object) => Promise
4040
1. A `Function` you can invoke to abort the retrying (bail)
4141
2. A `Number` identifying the attempt. The absolute first attempt (before any retries) is `1`.
4242
- The `opts` are passed to `node-retry`. Read [its docs](https://github.com/tim-kos/node-retry)
43-
* `retries`: The maximum amount of times to retry the operation. Default is `10`.
44-
* `factor`: The exponential factor to use. Default is `2`.
45-
* `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.
46-
* `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.
47-
* `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `true`.
48-
* `onRetry`: an optional `Function` that is invoked after a new retry is performed. It's passed the `Error` that triggered it as a parameter.
43+
- `retries`: The maximum amount of times to retry the operation. Default is `10`.
44+
- `factor`: The exponential factor to use. Default is `2`.
45+
- `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.
46+
- `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.
47+
- `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `true`.
48+
- `onRetry`: an optional `Function` that is invoked after a new retry is performed. It's passed the `Error` that triggered it as a parameter.
4949
5050
## Authors
5151
52-
- Guillermo Rauch ([@rauchg](https://twitter.com/rauchg)) - [ZEIT](https://zeit.co)
53-
- Leo Lamprecht ([@notquiteleo](https://twitter.com/notquiteleo)) - [ZEIT](https://zeit.co)
52+
- Guillermo Rauch ([@rauchg](https://twitter.com/rauchg)) - [Vercel](https://vercel.com)
53+
- Leo Lamprecht ([@notquiteleo](https://twitter.com/notquiteleo)) - [Vercel](https://vercel.com)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lib"
1414
],
1515
"license": "MIT",
16-
"repository": "zeit/async-retry",
16+
"repository": "vercel/async-retry",
1717
"ava": {
1818
"failFast": true
1919
},

0 commit comments

Comments
 (0)