diff --git a/pkg/search/proxy/store/multi_cluster_cache.go b/pkg/search/proxy/store/multi_cluster_cache.go index 29eb2b05cb80..4858e8f7d1fc 100644 --- a/pkg/search/proxy/store/multi_cluster_cache.go +++ b/pkg/search/proxy/store/multi_cluster_cache.go @@ -7,6 +7,7 @@ import ( "sort" "strings" "sync" + "time" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -61,6 +62,13 @@ func NewMultiClusterCache(newClientFunc func(string) (dynamic.Interface, error), // UpdateCache update cache for multi clusters func (c *MultiClusterCache) UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]struct{}) error { + if klog.V(3).Enabled() { + start := time.Now() + defer func() { + klog.Infof("MultiClusterCache update cache takes %v", time.Since(start)) + }() + } + c.lock.Lock() defer c.lock.Unlock() diff --git a/pkg/search/proxy/store/resource_cache.go b/pkg/search/proxy/store/resource_cache.go index c3e271c88b35..e31d99e131ba 100644 --- a/pkg/search/proxy/store/resource_cache.go +++ b/pkg/search/proxy/store/resource_cache.go @@ -34,7 +34,7 @@ type resourceCache struct { func (c *resourceCache) stop() { klog.Infof("Stop store for %s %s", c.clusterName, c.resource) - c.Store.DestroyFunc() + go c.Store.DestroyFunc() } func newResourceCache(clusterName string, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind,