From 1b53e62cb873ba16968b7c25a81baff0947d705c Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Tue, 30 Jan 2024 05:38:35 -0300 Subject: [PATCH] Increase API timeout and add custom message (#299) --- ragna/deploy/_cli/core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ragna/deploy/_cli/core.py b/ragna/deploy/_cli/core.py index 985b70e5..4d4469df 100644 --- a/ragna/deploy/_cli/core.py +++ b/ragna/deploy/_cli/core.py @@ -131,12 +131,19 @@ def check_api_available() -> bool: try: if process is not None: - @timeout_after() + @timeout_after(60) def wait_for_api() -> None: while not check_api_available(): time.sleep(0.5) - wait_for_api() + try: + wait_for_api() + except TimeoutError: + rich.print( + "Failed to start the API in 60 seconds. " + "Please start it manually with [bold]ragna api[/bold]." + ) + raise typer.Exit(1) ui_app(config).serve() # type: ignore[no-untyped-call] finally: