Skip to content

Commit f91db10

Browse files
committed
Pass session to server health
1 parent fcb9286 commit f91db10

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/ethereum_clis/transition_tool.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)