diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go index 4976d34ecc9147b661de0609e41e6c4d28bdd6cc..0ffeb3ef7e9e4f043a2a34e174f991b214e4f97a 100644 --- a/registry/protocol/protocol.go +++ b/registry/protocol/protocol.go @@ -44,7 +44,8 @@ import ( ) var ( - regProtocol = newRegistryProtocol() + regProtocol *registryProtocol + once sync.Once ) type registryProtocol struct { @@ -348,6 +349,9 @@ func setProviderUrl(regURL *common.URL, providerURL *common.URL) { // GetProtocol ... func GetProtocol() protocol.Protocol { + once.Do(func() { + regProtocol = newRegistryProtocol() + }) return regProtocol }