Commit e160fdd7 by guanghui.cui

连接ods失败后,增加延时时间

parent 27d8b327
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
INITIALIZE_EASYLOGGINGPP INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.5 Beta4" //版本号 #define VERSION "1.0.6" //版本号
std::string g_init_data; std::string g_init_data;
std::string g_init_data_ods_back; std::string g_init_data_ods_back;
...@@ -324,6 +324,7 @@ int main(int argc,char *argv[]) ...@@ -324,6 +324,7 @@ int main(int argc,char *argv[])
if (odsPushData.empty()|| !jsonTool.isInitBackValid(odsPushData.data())) { if (odsPushData.empty()|| !jsonTool.isInitBackValid(odsPushData.data())) {
LOG(INFO) << "invalid data,close connect"; LOG(INFO) << "invalid data,close connect";
ods.close(); //当连接到负载均衡,并没有和ods建立连接的时候。返回值为空,所以应该关闭重新连接 ods.close(); //当连接到负载均衡,并没有和ods建立连接的时候。返回值为空,所以应该关闭重新连接
os_sleep(10);
} }
int count=0; int count=0;
while(!bInitDone){ while(!bInitDone){
...@@ -333,7 +334,7 @@ int main(int argc,char *argv[]) ...@@ -333,7 +334,7 @@ int main(int argc,char *argv[])
os_sleep(1); //防止在ods挂掉后狂刷日志 os_sleep(1); //防止在ods挂掉后狂刷日志
break; break;
} }
os_sleep(1); os_sleep(2);
count++; count++;
//如果10s没有初始化完成,则跳出循环,重新连接 //如果10s没有初始化完成,则跳出循环,重新连接
if(10==count){ if(10==count){
...@@ -347,13 +348,13 @@ int main(int argc,char *argv[]) ...@@ -347,13 +348,13 @@ int main(int argc,char *argv[])
else{ else{
LOG(INFO)<<"Haven't receive init data"; LOG(INFO)<<"Haven't receive init data";
} }
os_sleep(3); os_sleep(10);
continue; continue;
} }
}else }else
{ {
LOG(INFO) << "connect ODS failed"; LOG(INFO) << "connect ODS failed";
os_sleep(5); os_sleep(10);
continue; continue;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment