Skip to content

Commit

Permalink
Merge pull request #911 from dubbo-x/read
Browse files Browse the repository at this point in the history
fix url compare in consul listener
  • Loading branch information
hxmhlt authored Dec 14, 2020
2 parents dd600c9 + 48142a7 commit 5ca20f5
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 44 deletions.
3 changes: 1 addition & 2 deletions common/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 1 addition & 4 deletions config/application_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
4 changes: 0 additions & 4 deletions config/base_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
7 changes: 2 additions & 5 deletions config/config_center_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

import (
"github.com/creasty/defaults"
perrors "github.com/pkg/errors"
)

import (
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions config/consumer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions config/method_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
5 changes: 1 addition & 4 deletions config/provider_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions config/reference_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand Down
5 changes: 1 addition & 4 deletions config/registry_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions metrics/prometheus/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sync"
"time"
)

import (
"github.com/prometheus/client_golang/prometheus"
)
Expand Down Expand Up @@ -64,20 +65,17 @@ var (

// should initialize after loading configuration
func init() {

extension.SetMetricReporter(reporterName, newPrometheusReporter)
}

// PrometheusReporter will collect the data for Prometheus
// 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
Expand Down
1 change: 1 addition & 0 deletions metrics/prometheus/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions metrics/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"time"
)

import (
"github.com/apache/dubbo-go/protocol"
)
Expand Down
5 changes: 1 addition & 4 deletions protocol/jsonrpc/jsonrpc_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion registry/consul/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 5ca20f5

Please sign in to comment.