Rename function, fix #36

pull/45/head
Doflatango 2017-10-18 16:38:09 +08:00
parent 002d565e17
commit 3a9c5c1d2e
2 changed files with 4 additions and 3 deletions

View File

@ -97,7 +97,7 @@ func RemoveNode(query interface{}) error {
}
func ISNodeFault(id string) (bool, error) {
func ISNodeAlive(id string) (bool, error) {
n := 0
err := mgoDB.WithC(Coll_Node, func(c *mgo.Collection) error {
var e error

View File

@ -182,7 +182,7 @@ func monitorNodes(n Noticer) {
switch {
case ev.Type == client.EventTypeDelete:
id = GetIDFromKey(string(ev.Kv.Key))
ok, err = ISNodeFault(id)
ok, err = ISNodeAlive(id)
if err != nil {
log.Warnf("query node[%s] err: %s", id, err.Error())
continue
@ -190,7 +190,8 @@ func monitorNodes(n Noticer) {
if ok {
n.Send(&Message{
Subject: "node[" + id + "] fault at time[" + time.Now().Format(time.RFC3339) + "]",
Subject: "Node[" + id + "] break away cluster, this happed at " + time.Now().Format(time.RFC3339),
Body: "Node breaked away cluster, this might happed when node crash or network problems.",
To: conf.Config.Mail.To,
})
}