Skip to content

Commit

Permalink
fix loop variable scope issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley committed May 9, 2023
1 parent aaf76b5 commit a7f737b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/cache/v3/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}
}
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/v3/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -358,7 +359,6 @@ func TestConcurrentSetWatch(t *testing.T) {
Node: &core.Node{Id: id},
TypeUrl: rsrc.EndpointType,
}, streamState, value)

defer cancel()
}
})
Expand Down

0 comments on commit a7f737b

Please sign in to comment.