Skip to content

Commit

Permalink
Merge pull request #3031 from ikaven1024/automated-cherry-pick-of-#30…
Browse files Browse the repository at this point in the history
…27-upstream-release-1.3

Automated cherry pick of #3027: stop proxy cache asynchronously
  • Loading branch information
karmada-bot authored Jan 10, 2023
2 parents ee53894 + 15cb35a commit 6f04aa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions pkg/search/proxy/store/multi_cluster_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sort"
"strings"
"sync"
"time"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion pkg/search/proxy/store/resource_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6f04aa7

Please sign in to comment.