Skip to content
Snippets Groups Projects
Commit a7e21e4f authored by beiwei.ly's avatar beiwei.ly
Browse files

use defer for wg.Done()

parent cf62d724
No related branches found
No related tags found
No related merge requests found
......@@ -200,12 +200,12 @@ func (c *RouterChain) buildCache() {
if p, ok := r.(router.Poolable); ok {
wg.Add(1)
go func(p router.Poolable) {
defer wg.Done()
pool, info := poolRouter(p, origin, invokers)
mutex.Lock()
defer mutex.Unlock()
cache.pools[p.Name()] = pool
cache.metadatas[p.Name()] = info
wg.Done()
}(p)
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment