From e320f3f7411bd50c519be161a241e6a6f7387031 Mon Sep 17 00:00:00 2001 From: wangwx Date: Thu, 29 Oct 2020 11:18:44 +0800 Subject: [PATCH] move unlock to defer --- protocol/dubbo/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index 2279058705..d7873bd3be 100644 --- a/protocol/dubbo/pool.go +++ b/protocol/dubbo/pool.go @@ -335,6 +335,7 @@ 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++ { @@ -342,7 +343,6 @@ func (p *gettyRPCClientPool) lazyInit() { } atomic.StoreUint32(&p.chInitialized, 1) } - p.Unlock() } func (p *gettyRPCClientPool) waitVacantConn() error {