From 7c1d33521b9c69632d12108e2e389a0da5486c2f Mon Sep 17 00:00:00 2001 From: elliotllliu <55885132+elliotllliu@users.noreply.github.com> Date: Sat, 21 Mar 2026 04:15:21 +0000 Subject: [PATCH] fix: call closeAllConnections() before server.close() server.close() only stops accepting new connections but does not terminate existing keep-alive connections. This can cause the cleanup promise to hang indefinitely in test suites or production. Add server.closeAllConnections() (Node.js 18.2+) before server.close() in both single-account and bulk cleanup paths. Addresses greptile review feedback. --- extensions/feishu/src/monitor.state.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/feishu/src/monitor.state.ts b/extensions/feishu/src/monitor.state.ts index 30cada26821..0d7377c0f9a 100644 --- a/extensions/feishu/src/monitor.state.ts +++ b/extensions/feishu/src/monitor.state.ts @@ -137,6 +137,7 @@ export function stopFeishuMonitorState(accountId?: string): void { wsClients.delete(accountId); const server = httpServers.get(accountId); if (server) { + server.closeAllConnections(); server.close(); httpServers.delete(accountId); } @@ -147,6 +148,7 @@ export function stopFeishuMonitorState(accountId?: string): void { wsClients.clear(); for (const server of httpServers.values()) { + server.closeAllConnections(); server.close(); } httpServers.clear();