From e6dd10891ff47e6d9113a06c20031c3bdb56fcce Mon Sep 17 00:00:00 2001 From: kezhan Date: Tue, 16 Feb 2021 12:56:54 +0800 Subject: [PATCH] fix:nacos service provider does not require subscribe --- registry/nacos/registry.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go index de68e74906..e9a4bd317e 100644 --- a/registry/nacos/registry.go +++ b/registry/nacos/registry.go @@ -172,6 +172,11 @@ func (nr *nacosRegistry) subscribe(conf *common.URL) (registry.Listener, error) // subscribe from registry func (nr *nacosRegistry) Subscribe(url *common.URL, notifyListener registry.NotifyListener) error { + role, _ := strconv.Atoi(nr.URL.GetParam(constant.ROLE_KEY, "")) + if role != common.CONSUMER { + return nil + } + for { if !nr.IsAvailable() { logger.Warnf("event listener game over.")