Browse Source

wind新服务器检测

longyu 3 years ago
parent
commit
527de1d2c1
3 changed files with 30 additions and 1 deletions
  1. 21 0
      services/data/edb_info.go
  2. 8 1
      services/task.go
  3. 1 0
      utils/constants.go

+ 21 - 0
services/data/edb_info.go

@@ -1412,3 +1412,24 @@ func ResetEdbInfoIsUpdate(cont context.Context) (err error) {
 	go data_manage.ResetEdbInfoIsUpdate()
 	return nil
 }
+
+// CheckWindDataInterface 检测wind数据服务器
+func CheckWindDataInterface(cont context.Context) (err error) {
+	go func() {
+		checkUrl := utils.Hz_Data_WIND_Url + `hz_server`
+		body, err := http.Get(checkUrl)
+		if err != nil {
+			//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+			msg := "检测Wind数据服务器2失败:CheckWindDataInterface ErrMsg:" + err.Error()
+			go alarm_msg.SendAlarmMsg(msg, 3)
+		} else {
+			result := string(body)
+			if result != `"ek true"` {
+				//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+				msg := "检测Wind数据服务器2失败:CheckWindDataInterface ErrMsg:" + string(body)
+				go alarm_msg.SendAlarmMsg(msg, 3)
+			}
+		}
+	}()
+	return
+}

+ 8 - 1
services/task.go

@@ -177,6 +177,10 @@ func releaseTask() {
 	checkLtDataInterface := task.NewTask("checkLtDataInterface", "0 */2 * * * * ", data.CheckLtDataInterface)
 	task.AddTask("checkLtDataInterface", checkLtDataInterface)
 
+	//检测wind新服务器
+	checkWindDataInterface := task.NewTask("checkWindDataInterface", "0 */2 * * * * ", data.CheckWindDataInterface)
+	task.AddTask("checkWindDataInterface", checkWindDataInterface)
+
 	//初始化指标更新状态
 	resetEdbInfoIsUpdate := task.NewTask("resetEdbInfoIsUpdate", "0 0 0 * * *", data.ResetEdbInfoIsUpdate)
 	task.AddTask("resetEdbInfoIsUpdate", resetEdbInfoIsUpdate)
@@ -214,7 +218,10 @@ func OneMinute(cont context.Context) (err error) {
 func RefreshData(cont context.Context) (err error) {
 	wg := sync.WaitGroup{}
 	wg.Add(8)
-	go data.RefreshDataFromWind(&wg)
+	hour := time.Now().Hour()
+	if hour != 0 {
+		go data.RefreshDataFromWind(&wg)
+	}
 	//同花顺
 	go data.RefreshDataFromThs(&wg)
 	//彭博

+ 1 - 0
utils/constants.go

@@ -97,6 +97,7 @@ const (
 	Hz_Data_Url    = "http://datawind.hzinsights.com:8040/" //同花顺,万得接口服务地址
 	Hz_Data_PB_Url = "http://datapb.hzinsights.com:8040/"   //彭博接口地址
 	Hz_Data_LT_Url = "http://dataek.hzinsights.com:8040/"   //路透社接口地址
+	Hz_Data_WIND_Url = "http://datawind2.hzinsights.com:8040/"   //路透社接口地址
 )
 
 //数据刷新频率