From 6209b52eae127170798f4c060843cc112f97c750 Mon Sep 17 00:00:00 2001 From: Ian Luo <ian.luo@gmail.com> Date: Tue, 8 Sep 2020 13:48:10 +0800 Subject: [PATCH] move debug() into refreshInvokers and remove update method --- registry/directory/directory.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/registry/directory/directory.go b/registry/directory/directory.go index 960855bc3..5d4a890c6 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -104,18 +104,8 @@ func (dir *RegistryDirectory) subscribe(url *common.URL) { } // Notify monitor changes from registry,and update the cacheServices -func (dir *RegistryDirectory) Notify(event ...*registry.ServiceEvent) { - go dir.update(event...) -} - -// update the cacheServices and subscribe service from registry -func (dir *RegistryDirectory) update(events ...*registry.ServiceEvent) { - for _, event := range events { - logger.Debugf("registry update, result{%s}", event) - logger.Debugf("update service name: %s!", event.Service) - } - - dir.refreshInvokers(events...) +func (dir *RegistryDirectory) Notify(events ...*registry.ServiceEvent) { + go dir.refreshInvokers(events...) } // refreshInvokers refreshes service's events. It supports two modes: incremental mode and batch mode. If a single @@ -140,6 +130,7 @@ func (dir *RegistryDirectory) refreshInvokers(events ...*registry.ServiceEvent) } for _, event := range events { + logger.Debugf("registry update, result{%s}", event) if oldInvoker, _ := dir.cacheInvokerByEvent(event); oldInvoker != nil { oldInvokers = append(oldInvokers, oldInvoker) } -- GitLab