feat(v4.1.16): add keepAlive, add lint script, edit lint errors

This commit is contained in:
JJ-Cro
2025-07-15 12:37:35 +02:00
parent 29b9776ce4
commit d26e756fa2
5 changed files with 14 additions and 5 deletions

View File

@@ -5,4 +5,3 @@ export * from './response/v5-spreadtrading';
export * from './shared';
export * from './shared-v5';
export * from './websockets';

View File

@@ -138,9 +138,17 @@ export default abstract class BaseRestClient {
// If enabled, configure a https agent with keepAlive enabled
if (this.options.keepAlive) {
// Extract existing https agent parameters, if provided, to prevent the keepAlive flag from overwriting
// an existing https agent completely
const existingHttpsAgent = this.globalRequestOptions.httpsAgent as
| https.Agent
| undefined;
const existingAgentOptions = existingHttpsAgent?.options || {};
// 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({
...existingAgentOptions,
keepAlive: true,
keepAliveMsecs: this.options.keepAliveMsecs,
});

View File

@@ -751,6 +751,7 @@ export class WebsocketClient extends BaseWebsocketClient<
if (!reqId) {
this.logger.error(
// eslint-disable-next-line max-len
'WS API response is missing reqId - promisified workflow could get stuck. If this happens, please get in touch with steps to reproduce. Trace:',
{
wsKey,