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:
@@ -767,7 +767,7 @@ func (w *watchCache) getAllEventsSinceLocked(resourceVersion uint64, key string,
|
|||||||
indexerFunc := func(i int) *watchCacheEvent {
|
indexerFunc := func(i int) *watchCacheEvent {
|
||||||
return w.cache[i%w.capacity]
|
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
|
return ci, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user