@@ -57,6 +57,9 @@ const (
57
57
// Limit is required to avoid memory spikes during cache initialization.
58
58
// The default limit of 50 is chosen based on experiments.
59
59
defaultListSemaphoreWeight = 50
60
+
61
+ // The default interval for monitoring the cluster connection status.
62
+ defaultClusterConnectionInterval = 10 * time .Second
60
63
)
61
64
62
65
const (
@@ -166,16 +169,17 @@ func NewClusterCache(config *rest.Config, opts ...UpdateSettingsFunc) *clusterCa
166
169
resyncTimeout : defaultClusterResyncTimeout ,
167
170
syncTime : nil ,
168
171
},
169
- watchResyncTimeout : defaultWatchResyncTimeout ,
170
- clusterSyncRetryTimeout : ClusterRetryTimeout ,
171
- resourceUpdatedHandlers : map [uint64 ]OnResourceUpdatedHandler {},
172
- eventHandlers : map [uint64 ]OnEventHandler {},
173
- log : log ,
174
- listRetryLimit : 1 ,
175
- listRetryUseBackoff : false ,
176
- listRetryFunc : ListRetryFuncNever ,
177
- connectionStatus : ConnectionStatusUnknown ,
178
- watchFails : newWatchFailures (),
172
+ watchResyncTimeout : defaultWatchResyncTimeout ,
173
+ clusterSyncRetryTimeout : ClusterRetryTimeout ,
174
+ resourceUpdatedHandlers : map [uint64 ]OnResourceUpdatedHandler {},
175
+ eventHandlers : map [uint64 ]OnEventHandler {},
176
+ log : log ,
177
+ listRetryLimit : 1 ,
178
+ listRetryUseBackoff : false ,
179
+ listRetryFunc : ListRetryFuncNever ,
180
+ connectionStatus : ConnectionStatusUnknown ,
181
+ watchFails : newWatchFailures (),
182
+ clusterConnectionInterval : defaultClusterConnectionInterval ,
179
183
}
180
184
for i := range opts {
181
185
opts [i ](cache )
@@ -198,6 +202,9 @@ type clusterCache struct {
198
202
// connectionStatus indicates the status of the connection with the cluster.
199
203
connectionStatus ConnectionStatus
200
204
205
+ // clusterConnectionInterval is the interval used to monitor the cluster connection status.
206
+ clusterConnectionInterval time.Duration
207
+
201
208
// watchFails is used to keep track of the failures while watching resources.
202
209
watchFails * watchFailures
203
210
@@ -1240,8 +1247,7 @@ func (c *clusterCache) StartClusterConnectionStatusMonitoring(ctx context.Contex
1240
1247
}
1241
1248
1242
1249
func (c * clusterCache ) clusterConnectionService (ctx context.Context ) {
1243
- clusterConnectionTimeout := 10 * time .Second
1244
- ticker := time .NewTicker (clusterConnectionTimeout )
1250
+ ticker := time .NewTicker (c .clusterConnectionInterval )
1245
1251
defer ticker .Stop ()
1246
1252
1247
1253
for {
0 commit comments