supeng 4 months ago
parent
commit
970ae468da

+ 1 - 1
longvideoapi/longvideoapi_config.py

@@ -21,7 +21,7 @@ port = "8080"
 alb_client_params = {
     'access_key_id': 'LTAI5tASD5yEZLeC8ffmNebY',
     'access_key_secret': '1PtsFRdp8viJmI78lEhNZR8MezWZBq',
-    'endpoint': 'alb-vpc.cn-hangzhou.aliyuncs.com',
+    'endpoint': 'alb.cn-hangzhou.aliyuncs.com',
     'region_id': 'cn-hangzhou'
 }
 # 购买机器权限

+ 0 - 3
longvideoapi/longvideoapi_unittest.py

@@ -11,9 +11,6 @@ class MyTestCase(unittest.TestCase):
             access_key_secret=longvideoapi_config.alb_client_params['access_key_secret'],
             endpoint=longvideoapi_config.alb_client_params['endpoint']
         )
-        ecs_client = utils.connect_client(access_key_id=longvideoapi_config.ecs_client_params['access_key_id'],
-                                          access_key_secret=longvideoapi_config.ecs_client_params['access_key_secret'],
-                                          region_id=longvideoapi_config.ecs_client_params['region_id'])
 
         instance_ids = utils.list_server_group_servers(alb_client, longvideoapi_config.server_group_id_list[0])
         logging.info(instance_ids)

+ 8 - 7
longvideoapi/utils.py

@@ -477,23 +477,24 @@ def list_server_group_servers(alb_client, server_group_id):
         try:
             list_server_group_servers_request = alb_20200616_models.ListServerGroupServersRequest(
                 server_group_id=server_group_id,
-                max_results=50,
+                max_results=100,
                 next_token=next_token
             )
-            runtime = util_models.RuntimeOptions(
-                connect_timeout=5000,
-                read_timeout=60000
-            )
+            runtime = util_models.RuntimeOptions()
+            # runtime = util_models.RuntimeOptions(
+            #     connect_timeout=5000,
+            #     read_timeout=60000
+            # )
             response = alb_client.list_server_group_servers_with_options(list_server_group_servers_request, runtime)
             next_token = UtilClient.to_map(response.body).get('NextToken')
             sub_instance_ids = [server.server_id for server in response.body.servers]
             if len(sub_instance_ids) > 0:
                 instance_ids.extend(sub_instance_ids)
-            else:
+            if next_token is None:
                 break
         except Exception as error:
             logging.error(error)
-        time.sleep(10)
+        time.sleep(3)
     return instance_ids