Skip to content

Commit

Permalink
Increase API timeout and add custom message (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
smokestacklightnin authored Jan 30, 2024
1 parent 01357a4 commit 1b53e62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ragna/deploy/_cli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1b53e62

Please sign in to comment.