1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-12 22:07:47 +02:00

Execute wrappers before router

This commit is contained in:
Asim Aslam
2019-01-11 15:49:54 +00:00
parent 9897c630ae
commit bfd341a269
4 changed files with 33 additions and 18 deletions

View File

@ -70,11 +70,9 @@ type router struct {
hdlrWrappers []HandlerWrapper
}
func newRpcRouter(opts Options) *router {
func newRpcRouter() *router {
return &router{
name: opts.Name,
hdlrWrappers: opts.HdlrWrappers,
serviceMap: make(map[string]*service),
serviceMap: make(map[string]*service),
}
}
@ -207,10 +205,6 @@ func (s *service) call(ctx context.Context, router *router, sending *sync.Mutex,
return nil
}
for i := len(router.hdlrWrappers); i > 0; i-- {
fn = router.hdlrWrappers[i-1](fn)
}
errmsg := ""
err := fn(ctx, r, replyv.Interface())
if err != nil {
@ -252,10 +246,6 @@ func (s *service) call(ctx context.Context, router *router, sending *sync.Mutex,
}
}
for i := len(router.hdlrWrappers); i > 0; i-- {
fn = router.hdlrWrappers[i-1](fn)
}
// client.Stream request
r.stream = true