mirror of
https://github.com/sct/overseerr.git
synced 2025-12-29 09:06:08 +01:00
fix(proxy): modify the registration of the axios interceptors (#1791)
The previous way of adding Axios interceptors added a new interceptor each time, causing lags after a while because of all the duplicate interceptors added. fix #1787
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { requestInterceptorFunction } from '@server/utils/customProxyAgent';
|
||||
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import rateLimit from 'axios-rate-limit';
|
||||
@@ -37,8 +38,7 @@ class ExternalAPI {
|
||||
...options.headers,
|
||||
},
|
||||
});
|
||||
this.axios.interceptors.request = axios.interceptors.request;
|
||||
this.axios.interceptors.response = axios.interceptors.response;
|
||||
this.axios.interceptors.request.use(requestInterceptorFunction);
|
||||
|
||||
if (options.rateLimit) {
|
||||
this.axios = rateLimit(this.axios, {
|
||||
|
||||
Reference in New Issue
Block a user