diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go index 57788975e79e226db760302bc9b603a678103ff5..0e175ddf2304d3713452a9897c98823ee653b65b 100644 --- a/cluster/router/chain/chain.go +++ b/cluster/router/chain/chain.go @@ -104,7 +104,9 @@ func (c *RouterChain) AddRouters(routers []router.PriorityRouter) { c.mutex.Lock() defer c.mutex.Unlock() c.routers = newRouters - c.notify <- struct{}{} + go func() { + c.notify <- struct{}{} + }() } // SetInvokers receives updated invokers from registry center. If the times of notification exceeds countThreshold and diff --git a/cluster/router/chain/chain_test.go b/cluster/router/chain/chain_test.go index f274d1b3182c6253d19135fc4c677d70630580e8..b4b3d72700b6aff6906622f732664b72fe6a0765 100644 --- a/cluster/router/chain/chain_test.go +++ b/cluster/router/chain/chain_test.go @@ -143,6 +143,11 @@ conditions: assert.NotNil(t, url) factory := extension.GetRouterFactory(url.Protocol) notify := make(chan struct{}) + go func() { + for { + <-notify + } + }() r, err := factory.NewPriorityRouter(url, notify) assert.Nil(t, err) assert.NotNil(t, r)