Reduce lock contention by using reader lock in watchcache interval

Kubernetes-commit: 6f0a400a1a7bb7d77d13181a91654f77f612c856
This commit is contained in:
Wojciech Tyczyński 2024-06-11 12:20:57 +02:00 committed by Kubernetes Publisher
parent 048664075f
commit 147e65f573
1 changed files with 1 additions and 1 deletions

View File

@ -767,7 +767,7 @@ func (w *watchCache) getAllEventsSinceLocked(resourceVersion uint64, key string,
indexerFunc := func(i int) *watchCacheEvent {
return w.cache[i%w.capacity]
}
ci := newCacheInterval(w.startIndex+first, w.endIndex, indexerFunc, w.indexValidator, &w.RWMutex)
ci := newCacheInterval(w.startIndex+first, w.endIndex, indexerFunc, w.indexValidator, w.RWMutex.RLocker())
return ci, nil
}