Merge pull request #105605 from sttts/sttts-watch-cache-multiple-blockers
apiserver/watchcache: doc watch event fan-out to blocked watchers better Kubernetes-commit: 194a3dea5de35dc819a49ccac4c0c34d35e39c39
This commit is contained in:
commit
5b4ea887d3
4
go.mod
4
go.mod
|
|
@ -46,7 +46,7 @@ require (
|
|||
gopkg.in/square/go-jose.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20211008163859-2a5dae08c42b
|
||||
k8s.io/apimachinery v0.0.0-20211011000437-91117332e378
|
||||
k8s.io/client-go v0.0.0-20211005163711-3511ef41b1fb
|
||||
k8s.io/client-go v0.0.0-20211011163815-7697067af710
|
||||
k8s.io/component-base v0.0.0-20211011003846-8870347bee41
|
||||
k8s.io/klog/v2 v2.20.0
|
||||
k8s.io/kube-openapi v0.0.0-20210817084001-7fbd8d59e5b8
|
||||
|
|
@ -59,6 +59,6 @@ require (
|
|||
replace (
|
||||
k8s.io/api => k8s.io/api v0.0.0-20211008163859-2a5dae08c42b
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20211011000437-91117332e378
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20211005163711-3511ef41b1fb
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20211011163815-7697067af710
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20211011003846-8870347bee41
|
||||
)
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -949,8 +949,8 @@ k8s.io/api v0.0.0-20211008163859-2a5dae08c42b h1:Nz70nzsUXXw2WjuESe7doPFLamYCkuq
|
|||
k8s.io/api v0.0.0-20211008163859-2a5dae08c42b/go.mod h1:uigk499NtRe0ine9Jz9mxVwAjascSPD/Ojn9xYSyB58=
|
||||
k8s.io/apimachinery v0.0.0-20211011000437-91117332e378 h1:68nXOP1wny9Hqo4ZRpk4dEZUBnaQAwE7jjzkVxm2/oE=
|
||||
k8s.io/apimachinery v0.0.0-20211011000437-91117332e378/go.mod h1:RAdi3McqM+9tkYHOyceb4XOeJWm9BCAF4BhZki5iiok=
|
||||
k8s.io/client-go v0.0.0-20211005163711-3511ef41b1fb h1:nga8yAXtOwTu2rBXgL2RUbberetndy68JG90SrjS/84=
|
||||
k8s.io/client-go v0.0.0-20211005163711-3511ef41b1fb/go.mod h1:dZcP7TWKqHJIMu4IsnFfjWNqT8QT8a42HCUk+yTX4uY=
|
||||
k8s.io/client-go v0.0.0-20211011163815-7697067af710 h1:sjhDoyTtoJBdLy/j7u+ArsUBDo4nPzroR12DTMLxMMA=
|
||||
k8s.io/client-go v0.0.0-20211011163815-7697067af710/go.mod h1:23ANvvt/Rdu4xgW4A1+kuplABnO2iM26sMSCe0iy4vc=
|
||||
k8s.io/component-base v0.0.0-20211011003846-8870347bee41 h1:tvTzEXRVIHckQFJX2Ys8uRbVnfnwuCPVlMoamQAyYfo=
|
||||
k8s.io/component-base v0.0.0-20211011003846-8870347bee41/go.mod h1:YPDB9OvJp4U0ttMfrwtCM8C2I7nx+m74DgAwYcvpFUo=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
|
||||
|
|
|
|||
|
|
@ -934,8 +934,11 @@ func (c *Cacher) dispatchEvent(event *watchCacheEvent) {
|
|||
timeout := c.dispatchTimeoutBudget.takeAvailable()
|
||||
c.timer.Reset(timeout)
|
||||
|
||||
// Make sure every watcher will try to send event without blocking first,
|
||||
// even if the timer has already expired.
|
||||
// Send event to all blocked watchers. As long as timer is running,
|
||||
// `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
|
||||
for _, watcher := range c.blockedWatchers {
|
||||
if !watcher.add(event, timer) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue