Добавлена возможность регистрировать прикладные апи

This commit is contained in:
2026-04-30 13:47:23 +03:00
parent 9eb7282437
commit 90422a0c2a
14 changed files with 474 additions and 5 deletions
+3 -2
View File
@@ -8,10 +8,11 @@ from uvicorn import Config, Server
class UvicornThreadRunner:
def __init__(self, host: str, port: int, timeout: int) -> None:
def __init__(self, host: str, port: int, timeout: int, *, thread_name: str = "plba-http-control") -> None:
self._host = host
self._port = port
self._timeout = timeout
self._thread_name = thread_name
self._server: Server | None = None
self._thread: Thread | None = None
self._error: BaseException | None = None
@@ -22,7 +23,7 @@ class UvicornThreadRunner:
self._error = None
config = Config(app=app, host=self._host, port=self._port, log_level="warning")
self._server = Server(config)
self._thread = Thread(target=self._serve, name="plba-http-control", daemon=True)
self._thread = Thread(target=self._serve, name=self._thread_name, daemon=True)
self._thread.start()
await self._wait_until_started()