v3.10.18: feat(#368) add config for HTTP keep alive via axios
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import axios, { AxiosRequestConfig, AxiosResponse, Method } from 'axios';
|
||||
import https from 'https';
|
||||
|
||||
import {
|
||||
APIID,
|
||||
@@ -137,6 +138,16 @@ export default abstract class BaseRestClient {
|
||||
},
|
||||
};
|
||||
|
||||
// If enabled, configure a https agent with keepAlive enabled
|
||||
if (this.options.keepAlive) {
|
||||
// For more advanced configuration, raise an issue on GitHub or use the "networkOptions"
|
||||
// parameter to define a custom httpsAgent with the desired properties
|
||||
this.globalRequestOptions.httpsAgent = new https.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: this.options.keepAliveMsecs,
|
||||
});
|
||||
}
|
||||
|
||||
this.baseUrl = getRestBaseUrl(!!this.options.testnet, restOptions);
|
||||
this.key = this.options.key;
|
||||
this.secret = this.options.secret;
|
||||
|
||||
Reference in New Issue
Block a user