change where we order the routes
This commit is contained in:
parent
934b8eb86d
commit
955dc2a23d
@ -110,6 +110,10 @@ func (p *Proxy) getRoute(service string) ([]router.Route, error) {
|
|||||||
for _, v := range r {
|
for _, v := range r {
|
||||||
routes = append(routes, v)
|
routes = append(routes, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort the routes in order of metric
|
||||||
|
sort.Slice(routes, func(i, j int) bool { return routes[i].Metric < routes[j].Metric })
|
||||||
|
|
||||||
return routes
|
return routes
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,9 +257,6 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server
|
|||||||
return p.serveRequest(ctx, p.Client, service, endpoint, req, rsp, client.WithAddress(addresses...))
|
return p.serveRequest(ctx, p.Client, service, endpoint, req, rsp, client.WithAddress(addresses...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the routes in order of metric
|
|
||||||
sort.Slice(routes, func(i, j int) bool { return routes[i].Metric < routes[j].Metric })
|
|
||||||
|
|
||||||
// there's no links e.g we're local routing then just serve it with addresses
|
// there's no links e.g we're local routing then just serve it with addresses
|
||||||
if local {
|
if local {
|
||||||
var opts []client.CallOption
|
var opts []client.CallOption
|
||||||
|
Loading…
Reference in New Issue
Block a user