This is an automated email from the ASF dual-hosted git repository.

laurence pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 026711bc0 Fix: ProviderConfig.Filter and ReferenceConfig.Filter not 
work
     new 07defad2e Merge pull request #1919 from ray2011/master
026711bc0 is described below

commit 026711bc0921596c819daa81500dbcc20f73af95
Author: raynor <[email protected]>
AuthorDate: Sat Jun 4 00:51:37 2022 +0800

    Fix: ProviderConfig.Filter and ReferenceConfig.Filter not work
---
 config/reference_config.go | 5 ++++-
 config/service_config.go   | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/config/reference_config.go b/config/reference_config.go
index 4c443f7e4..f370691b0 100644
--- a/config/reference_config.go
+++ b/config/reference_config.go
@@ -96,6 +96,9 @@ func (rc *ReferenceConfig) Init(root *RootConfig) error {
                        rc.Version = root.Application.Version
                }
        }
+       if rc.Filter == "" {
+               rc.Filter = root.Consumer.Filter
+       }
        if rc.Cluster == "" {
                rc.Cluster = "failover"
        }
@@ -309,7 +312,7 @@ func (rc *ReferenceConfig) getURLMap() url.Values {
        if rc.Generic != "" {
                defaultReferenceFilter = constant.GenericFilterKey + "," + 
defaultReferenceFilter
        }
-       urlMap.Set(constant.ReferenceFilterKey, 
mergeValue(rc.rootConfig.Consumer.Filter, "", defaultReferenceFilter))
+       urlMap.Set(constant.ReferenceFilterKey, mergeValue(rc.Filter, "", 
defaultReferenceFilter))
 
        for _, v := range rc.Methods {
                urlMap.Set("methods."+v.Name+"."+constant.LoadbalanceKey, 
v.LoadBalance)
diff --git a/config/service_config.go b/config/service_config.go
index 9627f2b91..1b41aa272 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -109,6 +109,9 @@ func (s *ServiceConfig) Init(rc *RootConfig) error {
        }
        s.exported = atomic.NewBool(false)
        s.metadataType = rc.Application.MetadataType
+       if s.Filter == "" {
+               s.Filter = rc.Provider.Filter
+       }
        if s.Version == "" {
                s.Version = rc.Application.Version
        }

Reply via email to