use noop resolver in network by default
This commit is contained in:
parent
a7c70c66b1
commit
65e6ee8566
@ -431,7 +431,7 @@ func (n *mucpNetwork) resolveNodes() ([]string, error) {
|
||||
}
|
||||
|
||||
// sort by lowest priority
|
||||
if err == nil {
|
||||
if err == nil && len(records) > 0 {
|
||||
sort.Slice(records, func(i, j int) bool { return records[i].Priority < records[j].Priority })
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package network
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/micro/go-micro/v3/network/resolver"
|
||||
"github.com/micro/go-micro/v3/network/resolver/registry"
|
||||
"github.com/micro/go-micro/v3/network/resolver/noop"
|
||||
"github.com/micro/go-micro/v3/proxy"
|
||||
"github.com/micro/go-micro/v3/proxy/mucp"
|
||||
"github.com/micro/go-micro/v3/router"
|
||||
@ -107,6 +107,6 @@ func DefaultOptions() Options {
|
||||
Tunnel: tunnel.NewTunnel(),
|
||||
Router: regRouter.NewRouter(),
|
||||
Proxy: mucp.NewProxy(),
|
||||
Resolver: ®istry.Resolver{},
|
||||
Resolver: new(noop.Resolver),
|
||||
}
|
||||
}
|
||||
|
13
network/resolver/noop/noop.go
Normal file
13
network/resolver/noop/noop.go
Normal file
@ -0,0 +1,13 @@
|
||||
// Package noop is a noop resolver
|
||||
package noop
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v3/network/resolver"
|
||||
)
|
||||
|
||||
type Resolver struct{}
|
||||
|
||||
// Resolve returns the list of nodes
|
||||
func (r *Resolver) Resolve(name string) ([]*resolver.Record, error) {
|
||||
return []*resolver.Record{}, nil
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
// Package static is a static resolver
|
||||
package registry
|
||||
package static
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/v3/network/resolver"
|
||||
|
Loading…
x
Reference in New Issue
Block a user