revert: restore force_close=True in compute._session()

The per-commit force_close=not _local optimisation reused TCP connections
for the loopback compute, but _session() is also used for the controller's
WebSocket heartbeat connection (_connect_notification -> ws_connect).
The different connector behaviour prevented the compute from receiving
pings, so no compute.updated events reached the WebUI and the compute
cache stayed empty.
This commit is contained in:
YueGuobin 2026-08-11 23:27:30 +08:00
parent 1dd334caff
commit fdcc7058cb
No known key found for this signature in database

View File

@ -106,13 +106,7 @@ class Compute:
def _session(self):
if self._http_session is None or self._http_session.closed is True:
# Reuse TCP keep-alive for local compute (loopback) to avoid paying
# a TCP handshake on every HTTP request; force-close for remote
# computes in case intermediate firewalls/NATs drop idle connections.
_local = self._host in ("127.0.0.1", "::1", "localhost")
connector = aiohttp.TCPConnector(
force_close=not _local, ssl_context=self._ssl_context
)
connector = aiohttp.TCPConnector(force_close=True, ssl_context=self._ssl_context)
self._http_session = aiohttp.ClientSession(connector=connector)
return self._http_session