Priority: HIGH
Package: @saga-ed/soa-api-core
Coach ref: ISSUES.md issue #9
ExpressServer.stop() calls http.Server.close() which stops accepting new connections but does not close existing keep-alive connections. This causes graceful shutdown to hang until connections time out or a force-exit timer fires.
Additionally, the underlying serverInstance (http.Server) is private with no getter, so consumers cannot call server.closeAllConnections() (available since Node.js 18.2+) or server.closeIdleConnections() themselves.
Requested changes:
- Call
this.serverInstance.closeAllConnections() after this.serverInstance.close() in ExpressServer.stop(), or add a configurable drain period before force-closing
- Make
stop() return a Promise<void> that resolves when the server is fully closed (currently returns void and uses a fire-and-forget callback)
- Expose the
http.Server instance via a getter (e.g., getServer()) so consumers can manage connection lifecycle if needed
Coach workaround: gqlServer.stop() is raced with a 2-second Promise.race timeout, and the overall force-exit timer is set to 5 seconds. Without this, shutdown hangs for 10+ seconds in development due to browser keep-alive connections from the Apollo Sandbox.
Priority: HIGH
Package:
@saga-ed/soa-api-coreCoach ref: ISSUES.md issue #9
ExpressServer.stop()callshttp.Server.close()which stops accepting new connections but does not close existing keep-alive connections. This causes graceful shutdown to hang until connections time out or a force-exit timer fires.Additionally, the underlying
serverInstance(http.Server) isprivatewith no getter, so consumers cannot callserver.closeAllConnections()(available since Node.js 18.2+) orserver.closeIdleConnections()themselves.Requested changes:
this.serverInstance.closeAllConnections()afterthis.serverInstance.close()inExpressServer.stop(), or add a configurable drain period before force-closingstop()return aPromise<void>that resolves when the server is fully closed (currently returnsvoidand uses a fire-and-forget callback)http.Serverinstance via a getter (e.g.,getServer()) so consumers can manage connection lifecycle if neededCoach workaround:
gqlServer.stop()is raced with a 2-secondPromise.racetimeout, and the overall force-exit timer is set to 5 seconds. Without this, shutdown hangs for 10+ seconds in development due to browser keep-alive connections from the Apollo Sandbox.