mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #105605 from sttts/sttts-watch-cache-multiple-blockers
apiserver/watchcache: doc watch event fan-out to blocked watchers better
This commit is contained in:
commit
194a3dea5d
@ -934,8 +934,11 @@ func (c *Cacher) dispatchEvent(event *watchCacheEvent) {
|
|||||||
timeout := c.dispatchTimeoutBudget.takeAvailable()
|
timeout := c.dispatchTimeoutBudget.takeAvailable()
|
||||||
c.timer.Reset(timeout)
|
c.timer.Reset(timeout)
|
||||||
|
|
||||||
// Make sure every watcher will try to send event without blocking first,
|
// Send event to all blocked watchers. As long as timer is running,
|
||||||
// even if the timer has already expired.
|
// `add` will wait for the watcher to unblock. After timeout,
|
||||||
|
// `add` will not wait, but immediately close a still blocked watcher.
|
||||||
|
// Hence, every watcher gets the chance to unblock itself while timer
|
||||||
|
// is running, not only the first ones in the list.
|
||||||
timer := c.timer
|
timer := c.timer
|
||||||
for _, watcher := range c.blockedWatchers {
|
for _, watcher := range c.blockedWatchers {
|
||||||
if !watcher.add(event, timer) {
|
if !watcher.add(event, timer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user