Skip to content

Commit 7686974

Browse files
committed
Add logic to try multiple times like updated AE plugin.
1 parent 1d49776 commit 7686974

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

finalize_install.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,23 @@ def send_sentry(message):
9494
else:
9595
main_proc = subprocess.Popen(command, cwd=directory)
9696
pid = main_proc.pid
97-
time.sleep(5)
9897
except Exception as e:
9998
send_sentry(f"Failed to start backend\n{e}\nCommand: {command}")
10099
raise e
101100

102-
try:
103-
r = client.get(f"http://127.0.0.1:8000/get_main_pid/{pid}")
104-
if r.status_code != 200:
105-
send_sentry(f"Failed to start backend\n{r.text}")
106-
raise Exception(f"Failed to start backend: {r.text}")
107-
except Exception as e:
108-
send_sentry(f"Failed to start backend\n{e}")
109-
raise e
101+
delayed = 0
102+
r = None
103+
while delayed < 30:
104+
try:
105+
time.sleep(1)
106+
delayed += 1
107+
r = client.get(f"http://127.0.0.1:8000/get_main_pid/{pid}", timeout=1)
108+
except Exception as e:
109+
pass
110+
if r is None:
111+
send_sentry(f"Failed to start backend\nTimeout after {delayed} seconds")
112+
raise Exception("nTimeout after {delayed} seconds")
113+
110114
try:
111115
client.get("http://127.0.0.1:8000/backend/shutdown")
112116
except:

0 commit comments

Comments
 (0)