Authored by qinchao

伸缩完善:查询伸缩组下的主机信息时,有可能网络中断造成一次错误,修改为错误发生5次才停止

@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 </div> 181 </div>
182 182
183 <script src="<%=basePath%>script/common/genarate_left_panel.js"></script> 183 <script src="<%=basePath%>script/common/genarate_left_panel.js"></script>
184 -<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171024-1"></script> 184 +<script src="<%=basePath%>script/autoscaling/autoscaling_new.js?v=20171113-1"></script>
185 <script> 185 <script>
186 $("#li_manager").addClass("active open"); 186 $("#li_manager").addClass("active open");
187 $("#li_autoscaling").addClass("active"); 187 $("#li_autoscaling").addClass("active");
@@ -379,6 +379,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit @@ -379,6 +379,7 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit
379 var url = contextPath + 'autoScalingTool/getIpsByScalingGroupId?groupName='+tmpGroupName+'&groupId='+souScalingGroupId+"&cloudType="+$("#cloudType").val(); 379 var url = contextPath + 'autoScalingTool/getIpsByScalingGroupId?groupName='+tmpGroupName+'&groupId='+souScalingGroupId+"&cloudType="+$("#cloudType").val();
380 writeToText("开始.........."); 380 writeToText("开始..........");
381 var count = 0; 381 var count = 0;
  382 + var errorTimes = 0;
382 var intervalIndex = setInterval(function() { 383 var intervalIndex = setInterval(function() {
383 $.ajax({ 384 $.ajax({
384 url: url, 385 url: url,
@@ -387,9 +388,16 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit @@ -387,9 +388,16 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit
387 timeout : 0, 388 timeout : 0,
388 success: function (data) { 389 success: function (data) {
389 if (!data || data.code != 200) { 390 if (!data || data.code != 200) {
390 - clearInterval(intervalIndex);  
391 - writeToText("发生错误,refCloudMessage data 程序终止..........");  
392 - responseError(data); 391 + errorTimes++;
  392 + if(errorTimes>5){
  393 + clearInterval(intervalIndex);
  394 + writeToText("发生错误data is null or data code !=200,refCloudMessage data 程序终止..........");
  395 + writeToText("data is "+data);
  396 + responseError(data);
  397 + }else{
  398 + writeToText("发生错误data is null or data code !=200,继续获取数据,请耐心等待,getIpsByScalingGroupId data errorTimes =."+errorTimes);
  399 + writeToText("data is "+data);
  400 + }
393 }else{ 401 }else{
394 //计算变化主机的ip 402 //计算变化主机的ip
395 var checkPassFlag=true; 403 var checkPassFlag=true;
@@ -436,9 +444,16 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit @@ -436,9 +444,16 @@ function refCloudMessage(cloudType,showMessage, serverChangeCount,desiredCapacit
436 count += 1; 444 count += 1;
437 }, 445 },
438 error: function (e) { 446 error: function (e) {
439 - clearInterval(intervalIndex);  
440 - writeToText("发生错误,refCloudMessage 程序终止..........");  
441 - requestError(url); 447 + errorTimes++;
  448 + if(errorTimes>5){
  449 + clearInterval(intervalIndex);
  450 + writeToText("发生错误error,refCloudMessage 程序终止..........");
  451 + writeToText("error is "+e);
  452 + requestError(url);
  453 + }else{
  454 + writeToText("发生错误error,继续获取数据,请耐心等待,getIpsByScalingGroupId data errorTimes =."+errorTimes);
  455 + writeToText("error is "+e);
  456 + }
442 } 457 }
443 }); 458 });
444 }, 20000); 459 }, 20000);