Browse Source

Increase retry attempts and add timeout for server check

Increased the retry attempts for server connection and added a timeout to the HTTP request.
pull/14682/head
Mohataseem Khan 6 months ago
committed by GitHub
parent
commit
41e55ab698
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      scripts/playwright/sql_databases/image02.py

10
scripts/playwright/sql_databases/image02.py

@ -25,12 +25,16 @@ process = subprocess.Popen(
["fastapi", "run", "docs_src/sql_databases/tutorial002.py"],
)
try:
for _ in range(3):
for _ in range(10):
try:
response = httpx.get("http://localhost:8000/docs")
response = httpx.get("http://localhost:8000/docs", timeout=1)
if response.status_code == 200:
break
except httpx.ConnectError:
time.sleep(1)
break
else:
raise RuntimeError("Server did not start in time")
with sync_playwright() as playwright:
run(playwright)
finally:

Loading…
Cancel
Save