storage/cacher/cache_watcher: processInterval sets RV from the snapshot

Kubernetes-commit: de735be512767dd2eced78530693d2e3ae997e6e
This commit is contained in:
Lukasz Szaszkiewicz 2024-09-20 08:48:31 +02:00 committed by Kubernetes Publisher
parent 743b5776f9
commit eb3a20ad8b
1 changed files with 7 additions and 0 deletions

View File

@ -454,6 +454,13 @@ func (c *cacheWatcher) processInterval(ctx context.Context, cacheInterval *watch
const initProcessThreshold = 500 * time.Millisecond const initProcessThreshold = 500 * time.Millisecond
startTime := time.Now() startTime := time.Now()
// cacheInterval may be created from a version being more fresh than requested
// (e.g. for NotOlderThan semantic). In such a case, we need to prevent watch event
// with lower resourceVersion from being delivered to ensure watch contract.
if cacheInterval.resourceVersion > resourceVersion {
resourceVersion = cacheInterval.resourceVersion
}
initEventCount := 0 initEventCount := 0
for { for {
event, err := cacheInterval.Next() event, err := cacheInterval.Next()