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()
|
||||
numClients := len(r.topologyClients)
|
||||
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",
|
||||
numClients,
|
||||
newLogClosure(func() string {
|
||||
return spew.Sdump(topologyDiff)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
r.RLock()
|
||||
for _, client := range r.topologyClients {
|
||||
|
Loading…
Reference in New Issue
Block a user