mirror of
https://github.com/arthur-pbty/portfolio2023.git
synced 2026-06-12 23:59:25 +02:00
modified
This commit is contained in:
-21
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Vercel, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
# async-retry
|
||||
|
||||
Retrying made simple, easy, and async.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// Packages
|
||||
const retry = require('async-retry');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
await retry(
|
||||
async (bail) => {
|
||||
// if anything throws, we retry
|
||||
const res = await fetch('https://google.com');
|
||||
|
||||
if (403 === res.status) {
|
||||
// don't retry upon 403
|
||||
bail(new Error('Unauthorized'));
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await res.text();
|
||||
return data.substr(0, 500);
|
||||
},
|
||||
{
|
||||
retries: 5,
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### API
|
||||
|
||||
```js
|
||||
retry(retrier : Function, opts : Object) => Promise
|
||||
```
|
||||
|
||||
- The supplied function can be `async` or not. In other words, it can be a function that returns a `Promise` or a value.
|
||||
- The supplied function receives two parameters
|
||||
1. A `Function` you can invoke to abort the retrying (bail)
|
||||
2. A `Number` identifying the attempt. The absolute first attempt (before any retries) is `1`.
|
||||
- The `opts` are passed to `node-retry`. Read [its docs](https://github.com/tim-kos/node-retry)
|
||||
- `retries`: The maximum amount of times to retry the operation. Default is `10`.
|
||||
- `factor`: The exponential factor to use. Default is `2`.
|
||||
- `minTimeout`: The number of milliseconds before starting the first retry. Default is `1000`.
|
||||
- `maxTimeout`: The maximum number of milliseconds between two retries. Default is `Infinity`.
|
||||
- `randomize`: Randomizes the timeouts by multiplying with a factor between `1` to `2`. Default is `true`.
|
||||
- `onRetry`: an optional `Function` that is invoked after a new retry is performed. It's passed the `Error` that triggered it as a parameter.
|
||||
|
||||
## Authors
|
||||
|
||||
- Guillermo Rauch ([@rauchg](https://twitter.com/rauchg)) - [Vercel](https://vercel.com)
|
||||
- Leo Lamprecht ([@notquiteleo](https://twitter.com/notquiteleo)) - [Vercel](https://vercel.com)
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"name": "async-retry",
|
||||
"version": "1.3.3",
|
||||
"description": "Retrying made simple, easy and async",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
"test": "yarn run test-lint && yarn run test-unit",
|
||||
"test-lint": "eslint .",
|
||||
"test-unit": "ava",
|
||||
"lint:staged": "lint-staged"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "vercel/async-retry",
|
||||
"ava": {
|
||||
"failFast": true
|
||||
},
|
||||
"dependencies": {
|
||||
"retry": "0.13.1"
|
||||
},
|
||||
"pre-commit": "lint:staged",
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint",
|
||||
"prettier --write --single-quote",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"no-var": 0,
|
||||
"prefer-arrow-callback": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "3.15.0",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-airbnb": "18.2.1",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-import": "2.24.0",
|
||||
"eslint-plugin-jsx-a11y": "6.4.1",
|
||||
"eslint-plugin-react": "7.24.0",
|
||||
"lint-staged": "11.1.2",
|
||||
"node-fetch": "2.6.1",
|
||||
"pre-commit": "1.2.2",
|
||||
"prettier": "2.3.2",
|
||||
"then-sleep": "1.0.1"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user