mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 19:23:40 +00:00
Add explanation about forgetFunc in cacher
This commit is contained in:
parent
f6c51d6e99
commit
605522b0c7
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user