diff --git a/pkg/cache/v3/simple.go b/pkg/cache/v3/simple.go index 5f7cf5d4c0..b927d63a22 100644 --- a/pkg/cache/v3/simple.go +++ b/pkg/cache/v3/simple.go @@ -366,7 +366,7 @@ func (cache *snapshotCache) CreateWatch(request *Request, streamState stream.Str cache.log.Errorf("failed to send a response for %s%v to nodeID %q: %s", request.TypeUrl, request.ResourceNames, nodeID, err) } - return nil + return func() {} } } } @@ -389,7 +389,7 @@ func (cache *snapshotCache) CreateWatch(request *Request, streamState stream.Str request.ResourceNames, nodeID, err) } - return nil + return func() {} } func (cache *snapshotCache) nextWatchID() int64 { diff --git a/pkg/cache/v3/simple_test.go b/pkg/cache/v3/simple_test.go index d5e1f92711..cc7ea14218 100644 --- a/pkg/cache/v3/simple_test.go +++ b/pkg/cache/v3/simple_test.go @@ -342,6 +342,7 @@ func TestSnapshotCacheWatch(t *testing.T) { func TestConcurrentSetWatch(t *testing.T) { c := cache.NewSnapshotCache(false, group{}, logger{t: t}) for i := 0; i < 50; i++ { + i := i t.Run(fmt.Sprintf("worker%d", i), func(t *testing.T) { t.Parallel() id := fmt.Sprintf("%d", i%2) @@ -358,7 +359,6 @@ func TestConcurrentSetWatch(t *testing.T) { Node: &core.Node{Id: id}, TypeUrl: rsrc.EndpointType, }, streamState, value) - defer cancel() } })