endpointOptions.idleTimeout
- 类型:<number>
- 默认:
0
在所有会话关闭且端点不再监听后,端点保持活动状态的秒数。值为 0(默认)表示端点仅在通过 endpoint.close() 或 endpoint.destroy() 显式关闭时才会被销毁。正值会在端点空闲时启动一个空闲计时器;如果在计时器触发之前没有创建新的会话,端点会自动被销毁。这对于连接池很有用,因为端点应短暂保留以供将来的 connect() 调用重用。
🌐 The number of seconds an endpoint will remain alive after all sessions have
closed and it is no longer listening. A value of 0 (default) means the
endpoint is only destroyed when explicitly closed via endpoint.close() or
endpoint.destroy(). A positive value starts an idle timer when the endpoint
becomes idle; if no new sessions are created before the timer fires, the
endpoint is automatically destroyed. This is useful for connection pooling
where endpoints should linger briefly for reuse by future connect() calls.