mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
chain unary interceptor
This commit is contained in:
parent
28fad04d5c
commit
ff22ea7108
@ -57,7 +57,7 @@ func run(port int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if client.CreateRpcRootNodes(config.GetServiceNames()); err != nil {
|
if err := client.CreateRpcRootNodes(config.GetServiceNames()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Println("api init discov client success")
|
fmt.Println("api init discov client success")
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func GrpcClient() grpc.DialOption {
|
func GrpcClient() grpc.DialOption {
|
||||||
return grpc.WithUnaryInterceptor(RpcClientInterceptor)
|
return grpc.WithChainUnaryInterceptor(RpcClientInterceptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RpcClientInterceptor(ctx context.Context, method string, req, resp interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) (err error) {
|
func RpcClientInterceptor(ctx context.Context, method string, req, resp interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) (err error) {
|
||||||
|
@ -153,5 +153,5 @@ func RpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GrpcServer() grpc.ServerOption {
|
func GrpcServer() grpc.ServerOption {
|
||||||
return grpc.UnaryInterceptor(RpcServerInterceptor)
|
return grpc.ChainUnaryInterceptor(RpcServerInterceptor)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user