File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff 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 } \n Command: { 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\n Timeout 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 :
You can’t perform that action at this time.
0 commit comments