Skip to content

Commit

Permalink
ignore node back to alive, because agent will update it
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Oct 11, 2022
1 parent bde8d38 commit ff9e284
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion selfmon/selfmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,18 @@ func (n *NodeStatusWatcher) dealNodeStatusMessage(ctx context.Context, message *
log.Errorf(ctx, "[NodeStatusWatcher] deal with node status stream message failed %+v", message)
return
}
// here we ignore node back to alive status because it will updated by agent
if message.Alive {
return
}

ctx, cancel := context.WithCancel(ctx)
defer cancel()

// TODO maybe we need a distributed lock to control concurrency
opts := &types.SetNodeOptions{
Nodename: message.Nodename,
WorkloadsDown: !message.Alive,
WorkloadsDown: true,
}
if _, err := n.cluster.SetNode(ctx, opts); err != nil {
log.Errorf(ctx, "[NodeStatusWatcher] set node %s failed %v", message.Nodename, err)
Expand Down

0 comments on commit ff9e284

Please sign in to comment.