Merge pull request #125438 from wojtek-t/watchcache_use_rlocker

Reduce lock contention by using reader lock in watchcache interval
This commit is contained in:
Kubernetes Prow Robot 2024-06-11 14:43:51 -07:00 committed by GitHub
commit 14b4dc83d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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
}