routing: do not reacquire the lock for topology notifications
This commit is contained in:
parent
273f030390
commit
3915c6a569
@ -113,14 +113,18 @@ func (r *ChannelRouter) notifyTopologyChange(topologyDiff *TopologyChange) {
|
|||||||
r.RLock()
|
r.RLock()
|
||||||
numClients := len(r.topologyClients)
|
numClients := len(r.topologyClients)
|
||||||
r.RUnlock()
|
r.RUnlock()
|
||||||
if numClients != 0 {
|
|
||||||
|
// Do not reacquire the lock twice unnecessarily.
|
||||||
|
if numClients == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
log.Tracef("Sending topology notification to %v clients %v",
|
log.Tracef("Sending topology notification to %v clients %v",
|
||||||
numClients,
|
numClients,
|
||||||
newLogClosure(func() string {
|
newLogClosure(func() string {
|
||||||
return spew.Sdump(topologyDiff)
|
return spew.Sdump(topologyDiff)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
r.RLock()
|
r.RLock()
|
||||||
for _, client := range r.topologyClients {
|
for _, client := range r.topologyClients {
|
||||||
|
Loading…
Reference in New Issue
Block a user