transport/grpc: replace deprecated grpc.WithTimeout() (#1822)
This commit is contained in:
		| @@ -94,9 +94,7 @@ func (t *grpcTransport) Dial(addr string, opts ...transport.DialOption) (transpo | ||||
| 		opt(&dopts) | ||||
| 	} | ||||
|  | ||||
| 	options := []grpc.DialOption{ | ||||
| 		grpc.WithTimeout(dopts.Timeout), | ||||
| 	} | ||||
| 	options := []grpc.DialOption{} | ||||
|  | ||||
| 	if t.opts.Secure || t.opts.TLSConfig != nil { | ||||
| 		config := t.opts.TLSConfig | ||||
| @@ -112,7 +110,9 @@ func (t *grpcTransport) Dial(addr string, opts ...transport.DialOption) (transpo | ||||
| 	} | ||||
|  | ||||
| 	// dial the server | ||||
| 	conn, err := grpc.Dial(addr, options...) | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), dopts.Timeout) | ||||
| 	defer cancel() | ||||
| 	conn, err := grpc.DialContext(ctx, addr, options...) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user