Merge pull request #3027 from ikaven1024/fix-stop

stop proxy cache asynchronously
This commit is contained in:
karmada-bot 2023-01-10 09:32:01 +08:00 committed by GitHub
commit 7c4d840885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"sort"
"strings"
"sync"
"time"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
@ -57,6 +58,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()

View File

@ -33,7 +33,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,