esi rate limit
This commit is contained in:
9
package-lock.json
generated
9
package-lock.json
generated
@@ -13,6 +13,7 @@
|
|||||||
"@vueuse/core": "^10.2.1",
|
"@vueuse/core": "^10.2.1",
|
||||||
"@vueuse/integrations": "^10.2.1",
|
"@vueuse/integrations": "^10.2.1",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"axios-rate-limit": "^1.3.1",
|
||||||
"loglevel": "^1.8.1",
|
"loglevel": "^1.8.1",
|
||||||
"loglevel-plugin-prefix": "^0.8.4",
|
"loglevel-plugin-prefix": "^0.8.4",
|
||||||
"oidc-client-ts": "^3.0.1",
|
"oidc-client-ts": "^3.0.1",
|
||||||
@@ -1364,6 +1365,14 @@
|
|||||||
"proxy-from-env": "^1.1.0"
|
"proxy-from-env": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/axios-rate-limit": {
|
||||||
|
"version": "1.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios-rate-limit/-/axios-rate-limit-1.3.1.tgz",
|
||||||
|
"integrity": "sha512-jt5E4FKY8Crqpe8RcyKZUHR9aiNHFg2L9oM7DqeuYj1oj0pV9AJWUhvn2Z9xMwGMnU6VRBEcZJFmW7ruiVx4Hw==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"axios": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/balanced-match": {
|
"node_modules/balanced-match": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
"@vueuse/core": "^10.2.1",
|
"@vueuse/core": "^10.2.1",
|
||||||
"@vueuse/integrations": "^10.2.1",
|
"@vueuse/integrations": "^10.2.1",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
|
"axios-rate-limit": "^1.3.1",
|
||||||
"loglevel": "^1.8.1",
|
"loglevel": "^1.8.1",
|
||||||
"loglevel-plugin-prefix": "^0.8.4",
|
"loglevel-plugin-prefix": "^0.8.4",
|
||||||
"oidc-client-ts": "^3.0.1",
|
"oidc-client-ts": "^3.0.1",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import axios, { AxiosInstance } from 'axios';
|
import axios, { AxiosInstance } from 'axios';
|
||||||
|
import rateLimit from 'axios-rate-limit';
|
||||||
import log from 'loglevel';
|
import log from 'loglevel';
|
||||||
|
|
||||||
export const logResource = (a: AxiosInstance) => {
|
export const logResource = (a: AxiosInstance) => {
|
||||||
@@ -14,11 +15,11 @@ export const logResource = (a: AxiosInstance) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const esiAxiosInstance = axios.create({
|
export const esiAxiosInstance = rateLimit(axios.create({
|
||||||
baseURL: import.meta.env.VITE_ESI_URL,
|
baseURL: import.meta.env.VITE_ESI_URL,
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
})
|
}), { maxRPS: 10 })
|
||||||
logResource(esiAxiosInstance)
|
logResource(esiAxiosInstance)
|
||||||
|
|||||||
Reference in New Issue
Block a user