fix zrpc client interceptor calling problem

This commit is contained in:
kevin
2020-10-20 17:57:41 +08:00
parent 907efd92c9
commit cee170f3e9
3 changed files with 24 additions and 20 deletions

View File

@@ -19,7 +19,6 @@ type (
ClientOption = internal.ClientOption
Client interface {
AddInterceptor(interceptor grpc.UnaryClientInterceptor)
Conn() *grpc.ClientConn
}
@@ -66,8 +65,8 @@ func NewClient(c RpcClientConf, options ...ClientOption) (Client, error) {
}, nil
}
func NewClientNoAuth(c discov.EtcdConf) (Client, error) {
client, err := internal.NewClient(internal.BuildDiscovTarget(c.Hosts, c.Key))
func NewClientNoAuth(c discov.EtcdConf, opts ...ClientOption) (Client, error) {
client, err := internal.NewClient(internal.BuildDiscovTarget(c.Hosts, c.Key), opts...)
if err != nil {
return nil, err
}
@@ -81,10 +80,6 @@ func NewClientWithTarget(target string, opts ...ClientOption) (Client, error) {
return internal.NewClient(target, opts...)
}
func (rc *RpcClient) AddInterceptor(interceptor grpc.UnaryClientInterceptor) {
rc.client.AddInterceptor(interceptor)
}
func (rc *RpcClient) Conn() *grpc.ClientConn {
return rc.client.Conn()
}