Skip to content
Snippets Groups Projects
Unverified Commit b5365b33 authored by vito.he's avatar vito.he Committed by GitHub
Browse files

Merge pull request #911 from dubbo-x/read

fix url compare in consul listener
parents ab774b57 c4fa94c1
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,6 @@ func NewProxy(invoke protocol.Invoker, callBack interface{}, attachments map[str
// Yyy func(ctx context.Context, args []interface{}, rsp *Zzz) error
// }
func (p *Proxy) Implement(v common.RPCService) {
// check parameters, incoming interface must be a elem's pointer.
valueOf := reflect.ValueOf(v)
logger.Debugf("[Implement] reflect.TypeOf: %s", valueOf.String())
......@@ -145,7 +144,7 @@ func (p *Proxy) Implement(v common.RPCService) {
inv.SetAttachments(k, value)
}
// add user setAttachment. It is compatibility with previous versions.
// add user setAttachment. It is compatibility with previous versions.
atm := invCtx.Value(constant.AttachmentKey)
if m, ok := atm.(map[string]string); ok {
for k, value := range m {
......
......@@ -48,8 +48,5 @@ func (c *ApplicationConfig) UnmarshalYAML(unmarshal func(interface{}) error) err
return err
}
type plain ApplicationConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
......@@ -33,10 +33,6 @@ import (
"github.com/apache/dubbo-go/common/logger"
)
type multiConfiger interface {
Prefix() string
}
// BaseConfig is the common configuration for provider and consumer
type BaseConfig struct {
ConfigCenterConfig *ConfigCenterConfig `yaml:"config_center" json:"config_center,omitempty"`
......
......@@ -26,6 +26,7 @@ import (
import (
"github.com/creasty/defaults"
perrors "github.com/pkg/errors"
)
import (
......@@ -35,7 +36,6 @@ import (
"github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/config_center"
perrors "github.com/pkg/errors"
)
// ConfigCenterConfig is configuration for config center
......@@ -69,10 +69,7 @@ func (c *ConfigCenterConfig) UnmarshalYAML(unmarshal func(interface{}) error) er
return err
}
type plain ConfigCenterConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
// GetUrlMap gets url map from ConfigCenterConfig
......
......@@ -71,10 +71,7 @@ func (c *ConsumerConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
return err
}
type plain ConsumerConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
// nolint
......
......@@ -57,8 +57,5 @@ func (c *MethodConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
return err
}
type plain MethodConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
......@@ -58,10 +58,7 @@ func (c *ProviderConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
return err
}
type plain ProviderConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
// nolint
......
......@@ -86,11 +86,7 @@ func (c *ReferenceConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
}
*c = ReferenceConfig(raw)
if err := defaults.Set(c); err != nil {
return err
}
return nil
return defaults.Set(c)
}
// Refer ...
......
......@@ -63,10 +63,7 @@ func (c *RegistryConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
return err
}
type plain RegistryConfig
if err := unmarshal((*plain)(c)); err != nil {
return err
}
return nil
return unmarshal((*plain)(c))
}
// nolint
......
......@@ -24,6 +24,7 @@ import (
"sync"
"time"
)
import (
"github.com/prometheus/client_golang/prometheus"
)
......@@ -64,7 +65,6 @@ var (
// should initialize after loading configuration
func init() {
extension.SetMetricReporter(reporterName, newPrometheusReporter)
}
......@@ -72,12 +72,10 @@ func init() {
// if you want to use this feature, you need to initialize your prometheus.
// https://prometheus.io/docs/guides/go-application/
type PrometheusReporter struct {
// report the consumer-side's summary data
consumerSummaryVec *prometheus.SummaryVec
// report the provider-side's summary data
providerSummaryVec *prometheus.SummaryVec
// report the provider-side's histogram data
providerHistogramVec *prometheus.HistogramVec
// report the consumer-side's histogram data
......
......@@ -26,6 +26,7 @@ import (
import (
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/extension"
......
......@@ -21,6 +21,7 @@ import (
"context"
"time"
)
import (
"github.com/apache/dubbo-go/protocol"
)
......
......@@ -45,10 +45,7 @@ func NewJsonrpcInvoker(url *common.URL, client *HTTPClient) *JsonrpcInvoker {
// Invoke the JSON RPC invocation and return result.
func (ji *JsonrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
var (
result protocol.RPCResult
)
var result protocol.RPCResult
inv := invocation.(*invocation_impl.RPCInvocation)
url := ji.GetUrl()
......
......@@ -107,7 +107,7 @@ func retrieveURL(service *consul.ServiceEntry) (*common.URL, error) {
func in(url *common.URL, urls []*common.URL) bool {
for _, url1 := range urls {
if url.URLEqual(url1) {
if common.IsEquals(url, url1) {
return true
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment