add cancelfn for timeout context
@@ -210,7 +210,8 @@ func createGrpcConn(ctx context.Context, address string) (*grpc.ClientConn, erro
opts = append(opts, grpc.WithDisableRetry())
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
}
- timeoutCtx, _ := context.WithTimeout(ctx, viper.GetDuration("timeout"))
+ timeoutCtx, cancel := context.WithTimeout(ctx, viper.GetDuration("timeout"))
+ defer cancel()
conn, err := grpc.DialContext(timeoutCtx, address, opts...)
if err != nil {
return nil, err
