ReportRaftComms periodically prints the state of the node (heartbeats in and out).
()
| 149 | |
| 150 | // ReportRaftComms periodically prints the state of the node (heartbeats in and out). |
| 151 | func (n *Node) ReportRaftComms() { |
| 152 | if !glog.V(3) { |
| 153 | return |
| 154 | } |
| 155 | ticker := time.Tick(time.Second) |
| 156 | |
| 157 | for range ticker { |
| 158 | out := atomic.SwapInt64(&n.heartbeatsOut, 0) |
| 159 | in := atomic.SwapInt64(&n.heartbeatsIn, 0) |
| 160 | glog.Infof("RaftComm: [%#x] Heartbeats out: %d, in: %d", n.Id, out, in) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | // SetRaft would set the provided raft.Node to this node. |
| 165 | // It would check fail if the node is already set. |
no test coverage detected