Kaynağa Gözat

feat:新增定时检测路透数据服务器任务

Roc 3 yıl önce
ebeveyn
işleme
09f491d913
2 değiştirilmiş dosya ile 19 ekleme ve 0 silme
  1. 16 0
      services/data/edb_info.go
  2. 3 0
      services/task.go

+ 16 - 0
services/data/edb_info.go

@@ -228,6 +228,22 @@ func CheckPbDataInterface(cont context.Context) (err error) {
 	return
 }
 
+// CheckLtDataInterface 检测路透数据服务器
+func CheckLtDataInterface(cont context.Context) (err error) {
+	go func() {
+		checkUrl := utils.Hz_Data_LT_Url + `hz_server`
+		body, err := http.Get(checkUrl)
+		if err != nil {
+			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+err.Error(), utils.EmailSendToUsers)
+		}
+		result := string(body)
+		if result != "ek true" {
+			go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"检测数据接口:失败提醒", "检测路透数据服务器失败:CheckLtDataInterface ErrMsg:"+string(body), utils.EmailSendToUsers)
+		}
+	}()
+	return
+}
+
 //刷新所有计算指标
 func RefreshDataFromCalculateAll() (err error) {
 	defer func() {

+ 3 - 0
services/task.go

@@ -134,6 +134,9 @@ func releaseTask() {
 	checkPbDataInterface := task.NewTask("checkPbDataInterface", "0 */2 * * * * ", data.CheckPbDataInterface)
 	task.AddTask("checkPbDataInterface", checkPbDataInterface)
 
+	checkLtDataInterface := task.NewTask("checkLtDataInterface", "0 */2 * * * * ", data.CheckLtDataInterface)
+	task.AddTask("checkLtDataInterface", checkLtDataInterface)
+
 	//初始化指标更新状态
 	resetEdbInfoIsUpdate := task.NewTask("resetEdbInfoIsUpdate", "0 0 0 * * *", data.ResetEdbInfoIsUpdate)
 	task.AddTask("resetEdbInfoIsUpdate", resetEdbInfoIsUpdate)