Skip to content

Commit

Permalink
Remove queryCache.checkQuery()
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Jan 27, 2021
1 parent 8fe99dc commit ef13c32
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions pkg/registry/common/querycache/nse_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"context"

"github.com/golang/protobuf/ptypes/empty"
"github.com/networkservicemesh/api/pkg/api/registry"
"google.golang.org/grpc"
"google.golang.org/protobuf/proto"

"github.com/networkservicemesh/api/pkg/api/registry"

"github.com/networkservicemesh/sdk/pkg/registry/common/memory"
"github.com/networkservicemesh/sdk/pkg/registry/core/next"
Expand Down Expand Up @@ -84,10 +84,6 @@ func (q *queryCacheNSEClient) Find(ctx context.Context, in *registry.NetworkServ
return
}

if q.checkQuery(ctx, nseQuery, opts...) != nil {
return
}

for update, err := stream.Recv(); err == nil; update, err = stream.Recv() {
if update.Name != nseQuery.NetworkServiceEndpoint.Name {
continue
Expand All @@ -104,23 +100,6 @@ func (q *queryCacheNSEClient) Find(ctx context.Context, in *registry.NetworkServ
return streamchannel.NewNetworkServiceEndpointFindClient(ctx, resultCh), nil
}

func (q *queryCacheNSEClient) checkQuery(ctx context.Context, nseQuery *registry.NetworkServiceEndpointQuery, opts ...grpc.CallOption) error {
nseQuery = proto.Clone(nseQuery).(*registry.NetworkServiceEndpointQuery)
nseQuery.Watch = false

findCtx, findCancel := context.WithCancel(q.chainCtx)
defer findCancel()

client, err := next.NetworkServiceEndpointRegistryClient(ctx).Find(findCtx, nseQuery, opts...)
if err != nil {
return err
}

_, err = client.Recv()

return err
}

func (q *queryCacheNSEClient) Unregister(ctx context.Context, in *registry.NetworkServiceEndpoint, opts ...grpc.CallOption) (*empty.Empty, error) {
return next.NetworkServiceEndpointRegistryClient(ctx).Unregister(ctx, in, opts...)
}
Expand Down

0 comments on commit ef13c32

Please sign in to comment.