Skip to content
Snippets Groups Projects
Commit 58bb83a4 authored by 邹毅贤's avatar 邹毅贤
Browse files

fix problems

parent eca2285e
No related branches found
No related tags found
No related merge requests found
......@@ -63,11 +63,12 @@ func (dir *staticDirectory) List(invocation protocol.Invocation) []protocol.Invo
localRouters := dir.routers
logger.Debug("========", len(localRouters))
if len(localRouters) > 0 {
for _, router := range localRouters {
if reflect.ValueOf(router.Url()).IsNil() || router.Url().GetParamBool(constant.RUNTIME_KEY, false) {
invokers = router.Route(invokers, *dir.ConsumerUrl, invocation)
}
if len(localRouters) == 0 {
return invokers
}
for _, router := range localRouters {
if reflect.ValueOf(router.Url()).IsNil() || router.Url().GetParamBool(constant.RUNTIME_KEY, false) {
return router.Route(invokers, *dir.ConsumerUrl, invocation)
}
}
return invokers
......
......@@ -35,7 +35,7 @@ func NewRouterChain(url common.URL) *RouterChain {
func (r RouterChain) AddRouters(routers []Router) {
r.routers = append(r.routers, routers...)
sort.Slice(r.routers, func(i, j int) bool {
sort.SliceStable(r.routers, func(i, j int) bool {
return routers[i].Priority() < routers[j].Priority()
})
}
......
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