Commit 816f90d8 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #41018 from kubernetes/revert-40735-avoid_copy_in_cacher

Automatic merge from submit-queue (batch tested with PRs 39681, 39321, 41018, 40883) Revert "Avoid unnecessary copies in cacher" Reverts kubernetes/kubernetes#40735 Ref #41013 [I don't think it's related, but just in case it is...]
parents 010559ec f616f067
......@@ -752,7 +752,7 @@ func (c *errWatcher) Stop() {
type cacheWatcher struct {
sync.Mutex
copier runtime.ObjectCopier
input chan *watchCacheEvent
input chan watchCacheEvent
result chan watch.Event
done chan struct{}
filter watchFilterFunc
......@@ -763,7 +763,7 @@ type cacheWatcher struct {
func newCacheWatcher(copier runtime.ObjectCopier, resourceVersion uint64, chanSize int, initEvents []*watchCacheEvent, filter watchFilterFunc, forget func(bool)) *cacheWatcher {
watcher := &cacheWatcher{
copier: copier,
input: make(chan *watchCacheEvent, chanSize),
input: make(chan watchCacheEvent, chanSize),
result: make(chan watch.Event, chanSize),
done: make(chan struct{}),
filter: filter,
......@@ -800,7 +800,7 @@ var timerPool sync.Pool
func (c *cacheWatcher) add(event *watchCacheEvent, budget *timeBudget) {
// Try to send the event immediately, without blocking.
select {
case c.input <- event:
case c.input <- *event:
return
default:
}
......@@ -820,7 +820,7 @@ func (c *cacheWatcher) add(event *watchCacheEvent, budget *timeBudget) {
defer timerPool.Put(t)
select {
case c.input <- event:
case c.input <- *event:
stopped := t.Stop()
if !stopped {
// Consume triggered (but not yet received) timer event
......@@ -928,7 +928,7 @@ func (c *cacheWatcher) process(initEvents []*watchCacheEvent, resourceVersion ui
}
// only send events newer than resourceVersion
if event.ResourceVersion > resourceVersion {
c.sendWatchCacheEvent(event)
c.sendWatchCacheEvent(&event)
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment