Skip to content

Commit

Permalink
move unlock to defer
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxuwan committed Oct 29, 2020
1 parent bd66105 commit e320f3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion protocol/dubbo/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,14 @@ func (p *gettyRPCClientPool) lazyInit() {
}
// Slow path.
p.Lock()
defer p.Unlock()
if p.chInitialized == 0 {
p.ch = make(chan struct{}, p.maxSize)
for i := 0; i < p.maxSize; i++ {
p.ch <- struct{}{}
}
atomic.StoreUint32(&p.chInitialized, 1)
}
p.Unlock()
}

func (p *gettyRPCClientPool) waitVacantConn() error {
Expand Down

0 comments on commit e320f3f

Please sign in to comment.