perf(tui): reduce cold-start latency

This commit is contained in:
chengyongru authored and chengyongru committed 2026-08-18 16:28:46 +08:00
1 parent 369a3443eb
commit df14259717
19 files changed
+669 -160

No files matched your search

+3 -3
View File
@@ -466,8 +466,8 @@ class GatewayClientLease:
self._write_state(state)
return True
def release(self, *, timeout_s: int = 20) -> bool:
"""Release this client and stop an ephemeral gateway when it was the last."""
def release(self, *, timeout_s: int = 20, wait_for_stop: bool = True) -> bool:
"""Release this client, optionally leaving last-client shutdown to the monitor."""
if not self._acquired:
return False
while True:
@@ -482,7 +482,7 @@ class GatewayClientLease:
self._acquired = False
should_stop = not clients and bool(state.get("auto_stop"))
self._write_or_clear(state)
if not should_stop:
if not should_stop or not wait_for_stop:
return False
result = self.runtime._stop(timeout_s=timeout_s)
stopped = result.ok or result.message in {