refactor(socket-utils): replace direct socket cleanup with centralized cleanupSocket utility across connection management

This commit is contained in:
2025-06-01 08:02:32 +00:00
parent eb2e67fecc
commit bed1a76537
5 changed files with 19 additions and 58 deletions

View File

@ -18,6 +18,7 @@ import { RequestHandler, type IMetricsTracker } from './request-handler.js';
import { WebSocketHandler } from './websocket-handler.js';
import { ProxyRouter } from '../../routing/router/index.js';
import { RouteRouter } from '../../routing/router/route-router.js';
import { cleanupSocket } from '../../core/utils/socket-utils.js';
import { FunctionCache } from './function-cache.js';
/**
@ -520,11 +521,7 @@ export class HttpProxy implements IMetricsTracker {
// Close all tracked sockets
for (const socket of this.socketMap.getArray()) {
try {
socket.destroy();
} catch (error) {
this.logger.error('Error destroying socket', error);
}
cleanupSocket(socket, 'http-proxy-stop');
}
// Close all connection pool connections