mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-17 14:42:06 +00:00
This reverts commit cd7a8dfde0.
This commit is contained in:
parent
5e849942c3
commit
5ba2d167ba
3 changed files with 31 additions and 129 deletions
11
run_agent.py
11
run_agent.py
|
|
@ -3992,18 +3992,17 @@ class AIAgent:
|
|||
return create_openai_client(self, client_kwargs, reason=reason, shared=shared)
|
||||
|
||||
@staticmethod
|
||||
def _force_close_tcp_sockets(client: Any, *, release_fds: bool = False) -> int:
|
||||
def _force_close_tcp_sockets(client: Any) -> int:
|
||||
"""Forwarder — see ``agent.agent_runtime_helpers.force_close_tcp_sockets``."""
|
||||
from agent.agent_runtime_helpers import force_close_tcp_sockets
|
||||
return force_close_tcp_sockets(client, release_fds=release_fds)
|
||||
return force_close_tcp_sockets(client)
|
||||
|
||||
def _close_openai_client(self, client: Any, *, reason: str, shared: bool) -> None:
|
||||
if client is None:
|
||||
return
|
||||
# Owning-thread dispose: shutdown + release FDs so already-shutdown
|
||||
# sockets don't linger in kernel CLOSED state (#61979). Cross-thread
|
||||
# abort uses _abort_request_openai_client (release_fds=False) instead.
|
||||
force_closed = self._force_close_tcp_sockets(client, release_fds=True)
|
||||
# Force-close TCP sockets first to prevent CLOSE-WAIT accumulation,
|
||||
# then do the graceful SDK-level close.
|
||||
force_closed = self._force_close_tcp_sockets(client)
|
||||
try:
|
||||
client.close()
|
||||
logger.info(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue