mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
storage/cacher: waitUntilWatchCacheFreshAndForceAllEvents checks if storage.RequestWatchProgress is supported
This commit is contained in:
parent
68baa105f0
commit
2db69ae1cd
@ -1303,9 +1303,14 @@ func (c *Cacher) getWatchCacheResourceVersion(ctx context.Context, parsedWatchRe
|
||||
// can wait for events without unnecessary blocking.
|
||||
func (c *Cacher) waitUntilWatchCacheFreshAndForceAllEvents(ctx context.Context, requestedWatchRV uint64, opts storage.ListOptions) error {
|
||||
if opts.SendInitialEvents != nil && *opts.SendInitialEvents {
|
||||
// TODO(p0lyn0mial): adapt the following logic once
|
||||
// https://github.com/kubernetes/kubernetes/pull/123264 merges
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ConsistentListFromCache) && c.watchCache.notFresh(requestedWatchRV) {
|
||||
// Here be dragons:
|
||||
// Since the etcd feature checker needs to check all members
|
||||
// to determine whether a given feature is supported,
|
||||
// we may receive a positive response even if the feature is not supported.
|
||||
//
|
||||
// In this very rare scenario, the worst case will be that this
|
||||
// request will wait for 3 seconds before it fails.
|
||||
if etcdfeature.DefaultFeatureSupportChecker.Supports(storage.RequestWatchProgress) && c.watchCache.notFresh(requestedWatchRV) {
|
||||
c.watchCache.waitingUntilFresh.Add()
|
||||
defer c.watchCache.waitingUntilFresh.Remove()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user