This commit is contained in:
root
2026-05-18 03:02:15 +00:00
parent 00953ad831
commit ab45c6c329
12 changed files with 233 additions and 56 deletions

View File

@@ -497,11 +497,12 @@ def _env_int(env: dict[str, str], key: str, default: int) -> int:
def _neko_http_ports(env: dict[str, str]) -> list[int]:
count = max(1, min(3, _env_int(env, "NEKO_INSTANCE_COUNT", 2)))
return [
_env_int(env, "NEKO_HTTP_PORT_1", _env_int(env, "NEKO_HTTP_PORT", 9200)),
_env_int(env, "NEKO_HTTP_PORT_2", 9201),
_env_int(env, "NEKO_HTTP_PORT_3", 9202),
]
][:count]
def _neko_instances(mdns_host: str, env: dict[str, str]) -> list[dict[str, Any]]:
@@ -877,13 +878,14 @@ async def stack_stream_probes() -> dict[str, Any]:
http = _probe_http_get(f"http://127.0.0.1:{port}/", timeout=2.5)
instances.append({"id": idx, "port": port, "tcp": tcp, "http": http})
primary = instances[0] if instances else {"port": 0, "tcp": {}, "http": {}}
required_count = max(1, min(3, _env_int(env, "NEKO_INSTANCE_COUNT", 2)))
return {
"port": primary["port"],
"tcp": primary["tcp"],
"http": primary["http"],
"instances": instances,
"running_count": sum(1 for item in instances if item["tcp"].get("ok")),
"required_count": 3,
"required_count": required_count,
}
srs_d, neko_d = await asyncio.gather(