Skip to content
Snippets Groups Projects
Commit 4a0c97fd authored by 李志信's avatar 李志信
Browse files

ftr: add grpc ctx transfer support

parent 9ae3c903
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,7 @@ func (gi *GrpcInvoker) Invoke(ctx context.Context, invocation protocol.Invocatio
}
var in []reflect.Value
in = append(in, reflect.ValueOf(context.Background()))
in = append(in, reflect.ValueOf(ctx))
in = append(in, invocation.ParameterValues()...)
methodName := invocation.MethodName()
......
......@@ -281,7 +281,7 @@ func (g *dubboGrpc) generateServerMethod(servName, fullServName string, method *
g.P(`invo := invocation.NewRPCInvocation("`, methName, `", args, nil)`)
g.P("if interceptor == nil {")
g.P("result := base.GetProxyImpl().Invoke(context.Background(), invo)")
g.P("result := base.GetProxyImpl().Invoke(ctx, invo)")
g.P("return result.Result(), result.Error()")
g.P("}")
......@@ -291,7 +291,7 @@ func (g *dubboGrpc) generateServerMethod(servName, fullServName string, method *
g.P("}")
g.P("handler := func(ctx ", contextPkg, ".Context, req interface{}) (interface{}, error) {")
g.P("result := base.GetProxyImpl().Invoke(context.Background(), invo)")
g.P("result := base.GetProxyImpl().Invoke(ctx, invo)")
g.P("return result.Result(), result.Error()")
g.P("}")
......
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