Merge pull request #75760 from wojtek-t/follow_comment_from_critical_sections

Add explanation about forgetFunc in cacher

Kubernetes-commit: 312eb890e6cf81fab43d88ae569802689a683065
This commit is contained in:
Kubernetes Publisher 2019-03-27 18:41:26 -07:00
commit 34f0f00795
2 changed files with 303 additions and 369 deletions

670
Godeps/Godeps.json generated

File diff suppressed because it is too large Load Diff

View File

@ -365,6 +365,8 @@ func (c *Cacher) Watch(ctx context.Context, key string, resourceVersion string,
// Create a watcher here to reduce memory allocations under lock, // Create a watcher here to reduce memory allocations under lock,
// given that memory allocation may trigger GC and block the thread. // given that memory allocation may trigger GC and block the thread.
// Also note that emptyFunc is a placeholder, until we will be able
// to compute watcher.forget function (which has to happen under lock).
watcher := newCacheWatcher(chanSize, filterWithAttrsFunction(key, pred), emptyFunc, c.versioner) watcher := newCacheWatcher(chanSize, filterWithAttrsFunction(key, pred), emptyFunc, c.versioner)
// We explicitly use thread unsafe version and do locking ourself to ensure that // We explicitly use thread unsafe version and do locking ourself to ensure that