From 605522b0c714c173d0a1ec8d00e46c3629107267 Mon Sep 17 00:00:00 2001 From: wojtekt Date: Wed, 27 Mar 2019 08:24:45 +0100 Subject: [PATCH] Add explanation about forgetFunc in cacher --- staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go index 2cd90d64a99..320c43c125a 100644 --- a/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go +++ b/staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go @@ -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, // 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) // We explicitly use thread unsafe version and do locking ourself to ensure that