stop proxy cache asynchronously
Signed-off-by: yingjinhui <yingjinhui@didiglobal.com>
This commit is contained in:
parent
0330535ed8
commit
ce158ec243
|
@ -7,6 +7,7 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||||
"k8s.io/apimachinery/pkg/api/meta"
|
"k8s.io/apimachinery/pkg/api/meta"
|
||||||
|
@ -57,6 +58,13 @@ func NewMultiClusterCache(newClientFunc func(string) (dynamic.Interface, error),
|
||||||
|
|
||||||
// UpdateCache update cache for multi clusters
|
// UpdateCache update cache for multi clusters
|
||||||
func (c *MultiClusterCache) UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]struct{}) error {
|
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()
|
c.lock.Lock()
|
||||||
defer c.lock.Unlock()
|
defer c.lock.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ type resourceCache struct {
|
||||||
|
|
||||||
func (c *resourceCache) stop() {
|
func (c *resourceCache) stop() {
|
||||||
klog.Infof("Stop store for %s %s", c.clusterName, c.resource)
|
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,
|
func newResourceCache(clusterName string, gvr schema.GroupVersionResource, gvk schema.GroupVersionKind,
|
||||||
|
|
Loading…
Reference in New Issue