Skip to content
Snippets Groups Projects
Commit d586f133 authored by Ming Deng's avatar Ming Deng
Browse files

Fix BUG: negative wait group count

parent 3d0e266d
No related branches found
No related tags found
No related merge requests found
...@@ -338,10 +338,10 @@ func setProviderUrl(regURL *common.URL, providerURL *common.URL) { ...@@ -338,10 +338,10 @@ func setProviderUrl(regURL *common.URL, providerURL *common.URL) {
} }
func GetProtocol() protocol.Protocol { func GetProtocol() protocol.Protocol {
if regProtocol != nil { if regProtocol == nil {
return regProtocol regProtocol = newRegistryProtocol()
} }
return newRegistryProtocol() return regProtocol
} }
type wrappedInvoker struct { type wrappedInvoker struct {
......
...@@ -291,3 +291,8 @@ func TestExportWithApplicationConfig(t *testing.T) { ...@@ -291,3 +291,8 @@ func TestExportWithApplicationConfig(t *testing.T) {
v2, _ := regProtocol.bounds.Load(getCacheKey(newUrl)) v2, _ := regProtocol.bounds.Load(getCacheKey(newUrl))
assert.NotNil(t, v2) assert.NotNil(t, v2)
} }
func TestGetProtocol(t *testing.T) {
singleton := GetProtocol()
assert.True(t, singleton == GetProtocol())
}
...@@ -109,7 +109,7 @@ func (l *RegistryConfigurationListener) Next() (*registry.ServiceEvent, error) { ...@@ -109,7 +109,7 @@ func (l *RegistryConfigurationListener) Next() (*registry.ServiceEvent, error) {
} }
} }
func (l *RegistryConfigurationListener) Close() { func (l *RegistryConfigurationListener) Close() {
l.registry.wg.Done() l.client.Close()
} }
func (l *RegistryConfigurationListener) valid() bool { func (l *RegistryConfigurationListener) valid() bool {
......
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