Browse Source

update longvideo_quick_restart & rov_server_quick_restart

liqian 2 years ago
parent
commit
bbaf8cb27b
2 changed files with 5 additions and 2 deletions
  1. 3 1
      longvideo_quick_restart.py
  2. 2 1
      rov_server_quick_restart.py

+ 3 - 1
longvideo_quick_restart.py

@@ -26,7 +26,8 @@ def server_health_check(client, instance_id):
     """
     global health_instances
     ip_address = utils.get_ip_address(client=client, instance_id=instance_id)
-    while True:
+    i = 0
+    while i < 7:
         health_check_url = f"http://{ip_address}:8080/longvideoapi/test"
         try:
             http_code = requests.get(health_check_url).status_code
@@ -39,6 +40,7 @@ def server_health_check(client, instance_id):
             break
         else:
             time.sleep(10)
+            i += 1
 
 
 def restart(slb_client, instance_id, image_name):

+ 2 - 1
rov_server_quick_restart.py

@@ -26,7 +26,8 @@ def server_health_check(client, instance_id):
     """
     global health_instances
     ip_address = utils.get_ip_address(client=client, instance_id=instance_id)
-    while True:
+    i = 0
+    while i < 7:
         health_check_url = f"http://{ip_address}:5001/healthcheck"
         try:
             http_code = requests.get(health_check_url).status_code