From b5a67e368a6a5e762fb378fa07a531773a70e121 Mon Sep 17 00:00:00 2001
From: pantianying <pantianying@gmail.com>
Date: Thu, 9 Jul 2020 10:22:31 +0800
Subject: [PATCH] fix bug for no provider by zookeeper

---
 common/rpc_service.go          | 2 +-
 remoting/zookeeper/listener.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/rpc_service.go b/common/rpc_service.go
index 05ca3721d..f8b8e0761 100644
--- a/common/rpc_service.go
+++ b/common/rpc_service.go
@@ -272,7 +272,7 @@ func (sm *serviceMap) UnRegister(interfaceName, protocol, serviceId string) erro
 		}
 	}
 	delete(svcs, serviceId)
-	if len(sm.serviceMap) == 0 {
+	if len(sm.serviceMap[protocol]) == 0 {
 		delete(sm.serviceMap, protocol)
 	}
 
diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go
index 1ffea88a8..948e0d73a 100644
--- a/remoting/zookeeper/listener.go
+++ b/remoting/zookeeper/listener.go
@@ -235,7 +235,7 @@ func (l *ZkEventListener) listenDirEvent(conf *common.URL, zkPath string, listen
 			// Only need to compare Path when subscribing to provider
 			if strings.LastIndex(zkPath, constant.PROVIDER_CATEGORY) != -1 {
 				provider, _ := common.NewURL(c)
-				if provider.Path != conf.Path {
+				if provider.ServiceKey() != conf.ServiceKey() {
 					continue
 				}
 			}
-- 
GitLab