mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 16:29:21 +00:00
Reduce lock contention by using reader lock in watchcache interval
This commit is contained in:
parent
291378cd33
commit
6f0a400a1a
@ -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
Block a user