refactor(peer): cleanup of some if boolean logic
I always get confused reading this code. Lets make it more clear, if flush then flush; else don't flush.pull/820/head
parent
b60b8b94ba
commit
36556bf8e0
8
peer.go
8
peer.go
|
@ -123,15 +123,15 @@ func (p *Peer) heartbeat(c chan bool) {
|
|||
for {
|
||||
select {
|
||||
case flush := <-stopChan:
|
||||
if !flush {
|
||||
debugln("peer.heartbeat.stop: ", p.Name)
|
||||
return
|
||||
} else {
|
||||
if flush {
|
||||
// before we can safely remove a node
|
||||
// we must flush the remove command to the node first
|
||||
p.flush()
|
||||
debugln("peer.heartbeat.stop.with.flush: ", p.Name)
|
||||
return
|
||||
} else {
|
||||
debugln("peer.heartbeat.stop: ", p.Name)
|
||||
return
|
||||
}
|
||||
|
||||
case <-ticker:
|
||||
|
|
Loading…
Reference in New Issue