Make node join event logging less noisy

Commit ca9a768d80
added a number of debugging messages for node join/leave
events.

This patch checks if a node already was listed,
and otherwise skips the logging to make the logs a bit
less noisy.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2017-07-08 03:55:07 -07:00
parent d01e1d38c3
commit 3dd1fb1217
1 changed files with 4 additions and 1 deletions

View File

@ -111,9 +111,12 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
switch nEvent.Type {
case NodeEventTypeJoin:
nDB.Lock()
_, found := nDB.nodes[n.Name]
nDB.nodes[n.Name] = n
nDB.Unlock()
logrus.Infof("Node join event for %s/%s", n.Name, n.Addr)
if !found {
logrus.Infof("Node join event for %s/%s", n.Name, n.Addr)
}
return true
case NodeEventTypeLeave:
nDB.Lock()