|
@@ -200,17 +200,29 @@ func NatsInit() {
|
|
|
logs.Println("创建sql临时文件失败")
|
|
|
}
|
|
|
sql_file := fmt.Sprintf("%sz_task_data_%s.sql", conf.Sql_Temp_Dir, T_task_id)
|
|
|
- org, err := Task.Dump_TaskData(T_task_id, conf.MysqlServer_Username, conf.MysqlServer_Password, conf.MysqlServer_UrlPort, conf.MysqlServer_Database, sql_file)
|
|
|
- if err != nil {
|
|
|
- logs.Error(lib.FuncName(), "导出本地数据失败")
|
|
|
- return
|
|
|
+
|
|
|
+ var org string
|
|
|
+
|
|
|
+ //导出线上数据
|
|
|
+ logs.Info("--------开始导出本地数据---------")
|
|
|
+ i := 0
|
|
|
+ for i < 10 {
|
|
|
+ org, err = Task.Dump_TaskData(T_task_id, conf.MysqlServer_Username, conf.MysqlServer_Password, conf.MysqlServer_UrlPort, conf.MysqlServer_Database, sql_file)
|
|
|
+ if err != nil {
|
|
|
+ logs.Error(lib.FuncName(), "导出本地数据失败", err)
|
|
|
+ } else {
|
|
|
+ System.Add_UserLogs_T(T_uuid, "任务数据-导出本地数据失败", "z_task_data_"+T_task_id, org)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ i++
|
|
|
}
|
|
|
- System.Add_UserLogs_T(T_uuid, "任务数据-更新线上数据", "z_task_data_"+T_task_id, org)
|
|
|
+
|
|
|
+
|
|
|
|
|
|
logs.Info("--------开始导入数据到【线上】---------")
|
|
|
- i := 0
|
|
|
+ j := 0
|
|
|
flag := false
|
|
|
- for i < 10 {
|
|
|
+ for j < 10 {
|
|
|
Task.Truncate_TaskData(conf.Server_AliasName, T_task_id)
|
|
|
time.Sleep(2 * time.Second)
|
|
|
org, err = Task.Insert_TaskData(conf.MysqlServer2_Username, conf.MysqlServer2_Password, conf.MysqlServer2_UrlPort, conf.MysqlServer2_Database, sql_file)
|
|
@@ -223,7 +235,7 @@ func NatsInit() {
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- i++
|
|
|
+ j++
|
|
|
}
|
|
|
// 重试10次后仍然没有成功导入数据
|
|
|
if !flag {
|