You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/05/20 13:46:06 UTC
[dubbo-go] branch 3.0 updated: Fix: Interface conversion when parsing Hystrix filter config in yaml file (#1883) (#1891)
This is an automated email from the ASF dual-hosted git repository.
alexstocks 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 6e465066e Fix: Interface conversion when parsing Hystrix filter config in yaml file (#1883) (#1891)
6e465066e is described below
commit 6e465066e1607ca2bdafb7f2d4eb874c113207f9
Author: Louie.Lu <46...@users.noreply.github.com>
AuthorDate: Fri May 20 21:45:59 2022 +0800
Fix: Interface conversion when parsing Hystrix filter config in yaml file (#1883) (#1891)
* add interface type check for hystrix config.
* Removes underscore from variable name.
Co-authored-by: luyi <lu...@qq.com>
---
filter/hystrix/filter.go | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/filter/hystrix/filter.go b/filter/hystrix/filter.go
index 52954d38d..df8203e61 100644
--- a/filter/hystrix/filter.go
+++ b/filter/hystrix/filter.go
@@ -21,6 +21,7 @@ package hystrix
import (
"context"
"fmt"
+ "reflect"
"regexp"
"sync"
)
@@ -252,7 +253,14 @@ func initConfigConsumer() error {
if config.GetConsumerConfig().FilterConf == nil {
return perrors.Errorf("no config for hystrix_consumer")
}
- filterConfig := config.GetConsumerConfig().FilterConf.(map[interface{}]interface{})[HYSTRIX]
+ filterConf := config.GetConsumerConfig().FilterConf
+ var filterConfig interface{}
+ switch reflect.ValueOf(filterConf).Interface().(type) {
+ case map[interface{}]interface{}:
+ filterConfig = config.GetConsumerConfig().FilterConf.(map[interface{}]interface{})[HYSTRIX]
+ case map[string]interface{}:
+ filterConfig = config.GetConsumerConfig().FilterConf.(map[string]interface{})[HYSTRIX]
+ }
if filterConfig == nil {
return perrors.Errorf("no config for hystrix_consumer")
}