|
@@ -1,12 +1,10 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
- "encoding/json"
|
|
|
"fmt"
|
|
|
log "github.com/donnie4w/go-logger/logger"
|
|
|
"net"
|
|
|
qu "qfw/util"
|
|
|
- "strings"
|
|
|
"sync"
|
|
|
"time"
|
|
|
)
|
|
@@ -77,7 +75,7 @@ func getRepeatTask() {
|
|
|
func extractRunningMonitoring() {
|
|
|
for {
|
|
|
if isAction {
|
|
|
- time_now := time.Now().Unix()
|
|
|
+ //time_now := time.Now().Unix()
|
|
|
isErr := false
|
|
|
methodlock.Lock()
|
|
|
for k, v := range extractAction {
|
|
@@ -90,44 +88,43 @@ func extractRunningMonitoring() {
|
|
|
continue
|
|
|
}
|
|
|
//心跳监测~回应
|
|
|
- keyArr := strings.Split(k, ":")
|
|
|
- if len(keyArr) == 3 {
|
|
|
- by, _ := json.Marshal(map[string]interface{}{
|
|
|
- "stype": "heart_extract",
|
|
|
- "skey": "heart_extract" + k,
|
|
|
- })
|
|
|
- sendSingleOtherNode(by, keyArr[0], keyArr[1])
|
|
|
- heartlock.Lock()
|
|
|
- heart_num := qu.IntAll(heartAction[k])
|
|
|
- heartAction[k] = heart_num + 1
|
|
|
- heartlock.Unlock()
|
|
|
- }
|
|
|
- life := qu.Int64All(v["life"])
|
|
|
- if time_now > life || qu.IntAll(heartAction[k]) > 10 {
|
|
|
- isErr = true //超时~无响应~认为机器异常
|
|
|
- data_mgo.UpdateById(data_c_name, qu.ObjToString(v["uid"]), map[string]interface{}{
|
|
|
- "$set": map[string]interface{}{
|
|
|
- "isuse": 0,
|
|
|
- },
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ //keyArr := strings.Split(k, ":")
|
|
|
+ //if len(keyArr) == 3 {
|
|
|
+ // by, _ := json.Marshal(map[string]interface{}{
|
|
|
+ // "stype": "heart_extract",
|
|
|
+ // "skey": "heart_extract" + k,
|
|
|
+ // })
|
|
|
+ // sendSingleOtherNode(by, keyArr[0], keyArr[1])
|
|
|
+ // heartlock.Lock()
|
|
|
+ // heart_num := qu.IntAll(heartAction[k])
|
|
|
+ // heartAction[k] = heart_num + 1
|
|
|
+ // heartlock.Unlock()
|
|
|
+ //}
|
|
|
+ //life := qu.Int64All(v["life"])
|
|
|
+ //if time_now > life || qu.IntAll(heartAction[k]) > 10 {
|
|
|
+ // isErr = true //超时~无响应~认为机器异常
|
|
|
+ // data_mgo.UpdateById(data_c_name, qu.ObjToString(v["uid"]), map[string]interface{}{
|
|
|
+ // "$set": map[string]interface{}{
|
|
|
+ // "isuse": 0,
|
|
|
+ // },
|
|
|
+ // })
|
|
|
+ //}
|
|
|
}
|
|
|
methodlock.Unlock()
|
|
|
if isErr {
|
|
|
- sid := qu.ObjToString(extractAction["extract_ids"]["sid"])
|
|
|
- eid := qu.ObjToString(extractAction["extract_ids"]["eid"])
|
|
|
- isAction = false
|
|
|
- sendStopExtractNode(using_ext_node) //停止
|
|
|
- if len(standby_ext_node) == 0 {
|
|
|
- sendErrMailApi("抽取控制中心~异常", fmt.Sprintf("机器异常~无备用机器~此段落需要过滤~%s~%s", sid, eid))
|
|
|
- time.Sleep(15 * time.Second)
|
|
|
- sendNextNode(sid, eid)
|
|
|
- } else {
|
|
|
- sendErrMailApi("抽取控制中心~异常", fmt.Sprintf("机器异常~有备用机器~启用备用机器~%s~%s", sid, eid))
|
|
|
- time.Sleep(15 * time.Second)
|
|
|
- dealWithExtUdpData(sid, eid)
|
|
|
- }
|
|
|
+ //sid := qu.ObjToString(extractAction["extract_ids"]["sid"])
|
|
|
+ //eid := qu.ObjToString(extractAction["extract_ids"]["eid"])
|
|
|
+ //isAction = false
|
|
|
+ //sendStopExtractNode(using_ext_node) //停止
|
|
|
+ //if len(standby_ext_node) == 0 {
|
|
|
+ // sendErrMailApi("抽取控制中心~异常", fmt.Sprintf("机器异常~无备用机器~此段落需要过滤~%s~%s", sid, eid))
|
|
|
+ // time.Sleep(15 * time.Second)
|
|
|
+ // sendNextNode(sid, eid)
|
|
|
+ //} else {
|
|
|
+ // sendErrMailApi("抽取控制中心~异常", fmt.Sprintf("机器异常~有备用机器~启用备用机器~%s~%s", sid, eid))
|
|
|
+ // time.Sleep(15 * time.Second)
|
|
|
+ // dealWithExtUdpData(sid, eid)
|
|
|
+ //}
|
|
|
}
|
|
|
}
|
|
|
time.Sleep(15 * time.Second)
|