fix: default to 0.0.0.0 to fix WSL2 health check failure (#520)
PR #470 changed the default listen host to undefined, letting Node.js bind to IPv6 :: on systems that support it. This broke WSL2 where IPv6 dual-stack is unreliable — the server binds to :: but IPv4 127.0.0.1 connections fail, causing the health check to time out. Revert to 0.0.0.0 as the default. Users who need IPv6 can set BIND_HOST=:: explicitly. Fixes #518 Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,9 @@ export function bindShutdown(server: any, groupChatServer?: any, chatRunServer?:
|
||||
if (isShuttingDown) return
|
||||
isShuttingDown = true
|
||||
|
||||
// Force exit after 3s no matter what
|
||||
setTimeout(() => process.exit(0), 3000)
|
||||
|
||||
logger.info('Shutting down (%s)...', signal)
|
||||
|
||||
try {
|
||||
@@ -24,13 +27,16 @@ export function bindShutdown(server: any, groupChatServer?: any, chatRunServer?:
|
||||
logger.info('Socket.IO closed')
|
||||
}
|
||||
|
||||
if (server) {
|
||||
await new Promise<void>((resolve) => {
|
||||
server.close(() => {
|
||||
logger.info('HTTP server closed')
|
||||
resolve()
|
||||
const servers = Array.isArray(server) ? server : [server].filter(Boolean)
|
||||
if (servers.length) {
|
||||
await Promise.all(servers.map((httpServer) => (
|
||||
new Promise<void>((resolve) => {
|
||||
httpServer.close(() => {
|
||||
logger.info('HTTP server closed')
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
})
|
||||
)))
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(err, 'Shutdown error')
|
||||
|
||||
Reference in New Issue
Block a user