fix&refactor: improve connection retry logic and remove unnecessary wait time for AWS instance readiness

This commit is contained in:
adlsdztony
2025-05-28 13:05:32 +08:00
parent f3d3cd9ed0
commit d8ae209162
2 changed files with 12 additions and 3 deletions

View File

@@ -51,7 +51,17 @@ class SetupController:
"parameters": dick like {str, Any} providing the keyword
parameters
}
"""
"""
# make sure connection can be established
retry = 0
while retry < 30:
try:
_ = requests.get(self.http_server + "/terminal")
break
except:
time.sleep(5)
retry += 1
logger.info(f"try to connect {self.http_server}, retry {retry}/30")
for cfg in config:
config_type: str = cfg["type"]