File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -296,20 +296,16 @@ def _evaluate_filesystem(
296296
297297 return output
298298
299- def _check_server_health (self ):
299+ def _check_server_health (self , session : Session ):
300300 """Check if the server is still responsive and restart if needed."""
301301 try :
302- with Session () as session :
303- # Try a simple health check with a minimal POST request
304- session .post (self .server_url , json = {}, timeout = 2 )
305-
302+ session .post (self .server_url , json = {}, timeout = 2 )
306303 return True
307304 except Exception :
308- # Server seems to be down, try to restart it
309305 self .shutdown ()
310306 time .sleep (0.1 )
311307 self .start_server ()
312- time .sleep (0.5 ) # give server time to restart
308+ time .sleep (0.5 )
313309 return False
314310
315311 def _server_post (
@@ -334,8 +330,7 @@ def _server_post(
334330 )
335331 break
336332 except (RequestsConnectionError , ReadTimeout ) as e :
337- # Try to restart the server if it's down
338- if not self ._check_server_health ():
333+ if not self ._check_server_health (session ):
339334 # Server was restarted, try again
340335 continue
341336 retries -= 1
You can’t perform that action at this time.
0 commit comments