Skip to content

Commit 65d77ef

Browse files
committed
clientutil: verify if cache is synced
1 parent fd8a3d6 commit 65d77ef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/util/client_util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package util
22

33
import (
44
"context"
5+
"fmt"
56

67
"k8s.io/apimachinery/pkg/runtime"
78
"k8s.io/client-go/rest"
@@ -19,6 +20,9 @@ func NewClientWithCachedReader(ctx context.Context, config *rest.Config, scheme
1920
}
2021
go ccache.Start(ctx)
2122
ccache.WaitForCacheSync(ctx)
23+
if !ccache.WaitForCacheSync(ctx) {
24+
return nil, nil, fmt.Errorf("failed to sync cache")
25+
}
2226
c, err := client.New(config, client.Options{
2327
Scheme: scheme,
2428
Cache: &client.CacheOptions{

0 commit comments

Comments
 (0)