feat: optimise Uvicorn Settings for heavy web socket use (#4028)
Co-authored-by: dadofsambonzuki <dadofsambonzuki@users.noreply.github.com> Co-authored-by: dni <office@dnilabs.com>
This commit is contained in:
co-authored by
dadofsambonzuki
dni
parent
4cb743d952
commit
fc73d83bd9
@@ -27,6 +27,8 @@ from lnbits.settings import set_cli_settings, settings
|
|||||||
@click.option(
|
@click.option(
|
||||||
"--reload", is_flag=True, default=False, help="Enable auto-reload for development"
|
"--reload", is_flag=True, default=False, help="Enable auto-reload for development"
|
||||||
)
|
)
|
||||||
|
@click.option("--ws-max-queue", default=128, help="Websocket max queue size")
|
||||||
|
@click.option("--ws-ping-timeout", default=60.0, help="Websocket ping timeout")
|
||||||
def main(
|
def main(
|
||||||
port: int,
|
port: int,
|
||||||
host: str,
|
host: str,
|
||||||
@@ -34,6 +36,8 @@ def main(
|
|||||||
ssl_keyfile: str,
|
ssl_keyfile: str,
|
||||||
ssl_certfile: str,
|
ssl_certfile: str,
|
||||||
reload: bool,
|
reload: bool,
|
||||||
|
ws_max_queue: int,
|
||||||
|
ws_ping_timeout: float,
|
||||||
):
|
):
|
||||||
"""Launched with `uv run lnbits` at root level"""
|
"""Launched with `uv run lnbits` at root level"""
|
||||||
|
|
||||||
@@ -58,6 +62,8 @@ def main(
|
|||||||
ssl_keyfile=ssl_keyfile,
|
ssl_keyfile=ssl_keyfile,
|
||||||
ssl_certfile=ssl_certfile,
|
ssl_certfile=ssl_certfile,
|
||||||
reload=reload or False,
|
reload=reload or False,
|
||||||
|
ws_ping_timeout=ws_ping_timeout,
|
||||||
|
ws_max_queue=ws_max_queue,
|
||||||
)
|
)
|
||||||
|
|
||||||
server = uvicorn.Server(config=config)
|
server = uvicorn.Server(config=config)
|
||||||
|
|||||||
Reference in New Issue
Block a user