From e10ef06a80bc19c24f0213caad0d38996220c2d0 Mon Sep 17 00:00:00 2001
From: CodingSinger <ooczzoo@gmail.com>
Date: Tue, 17 Mar 2020 22:18:15 +0800
Subject: [PATCH] Modify registryProtocol as a singleton to fix graceful
 shutdown

---
 registry/protocol/protocol.go | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go
index a7678ba4e..4976d34ec 100644
--- a/registry/protocol/protocol.go
+++ b/registry/protocol/protocol.go
@@ -44,7 +44,7 @@ import (
 )
 
 var (
-	regProtocol *registryProtocol
+	regProtocol = newRegistryProtocol()
 )
 
 type registryProtocol struct {
@@ -348,10 +348,7 @@ func setProviderUrl(regURL *common.URL, providerURL *common.URL) {
 
 // GetProtocol ...
 func GetProtocol() protocol.Protocol {
-	if regProtocol != nil {
-		return regProtocol
-	}
-	return newRegistryProtocol()
+	return regProtocol
 }
 
 type wrappedInvoker struct {
-- 
GitLab