Skip to content

Commit

Permalink
fix: wait also when status code is not 200
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Leclerc <[email protected]>
  • Loading branch information
sylvlecl committed Oct 2, 2024
1 parent d9ed773 commit 998079f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/antares_web_installer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import textwrap
import time
import webbrowser
from contextlib import suppress
from difflib import SequenceMatcher
from pathlib import Path
from shutil import copy2, copytree
Expand Down Expand Up @@ -300,13 +301,12 @@ def start_server(self):

while nb_attempts < max_attempts:
logger.info(f"Waiting for server start (attempt #{nb_attempts})...")
try:
with suppress(httpx.RequestError):
res = httpx.get(SERVER_ADDRESS + "/health", timeout=1)
if res.status_code == 200:
logger.info("The server is now running.")
break
except httpx.RequestError:
time.sleep(1)
time.sleep(1)
nb_attempts += 1
else:
stdout, stderr = server_process.communicate()
Expand Down

0 comments on commit 998079f

Please sign in to comment.