feat(fetcher): add retry capability using axios-retry
This commit is contained in:
parent
349c26c9b5
commit
1c1ffcd19b
3 changed files with 31 additions and 1 deletions
25
package-lock.json
generated
25
package-lock.json
generated
|
|
@ -11,6 +11,7 @@
|
|||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"axios-cache-interceptor": "^1.8.0",
|
||||
"axios-retry": "^4.5.0",
|
||||
"bytes": "^3.1.2",
|
||||
"cheerio": "^1.0.0",
|
||||
"country-emoji": "^1.5.6",
|
||||
|
|
@ -2137,6 +2138,18 @@
|
|||
"axios": ">= 0.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axios-retry": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-4.5.0.tgz",
|
||||
"integrity": "sha512-aR99oXhpEDGo0UuAlYcn2iGRds30k366Zfa05XWScR9QaQD4JYiP3/1Qt1u7YlefUOK+cn0CcwoL1oefavQUlQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"is-retry-allowed": "^2.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"axios": "0.x || 1.x"
|
||||
}
|
||||
},
|
||||
"node_modules/babel-jest": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz",
|
||||
|
|
@ -4364,6 +4377,18 @@
|
|||
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-retry-allowed": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz",
|
||||
"integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-stream": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"axios-cache-interceptor": "^1.8.0",
|
||||
"axios-retry": "^4.5.0",
|
||||
"bytes": "^3.1.2",
|
||||
"cheerio": "^1.0.0",
|
||||
"country-emoji": "^1.5.6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import express, { NextFunction, Request, Response } from 'express';
|
||||
import axios from 'axios';
|
||||
import axiosRetry from 'axios-retry';
|
||||
import { setupCache } from 'axios-cache-interceptor';
|
||||
import winston from 'winston';
|
||||
import { FrenchCloud, Handler, KinoKiste, MeineCloud, MostraGuarda, VerHdLink } from './handler';
|
||||
|
|
@ -19,7 +20,10 @@ const logger = winston.createLogger({
|
|||
],
|
||||
});
|
||||
|
||||
const fetcher = new Fetcher(setupCache(axios), logger);
|
||||
setupCache(axios);
|
||||
axiosRetry(axios, { retries: 3, retryDelay: axiosRetry.exponentialDelay });
|
||||
|
||||
const fetcher = new Fetcher(axios, logger);
|
||||
|
||||
const embedExtractors = new EmbedExtractorRegistry(logger, fetcher);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue