Reduce lock contention by using reader lock in watchcache interval
Kubernetes-commit: 6f0a400a1a7bb7d77d13181a91654f77f612c856
This commit is contained in:
parent
048664075f
commit
147e65f573
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue