@@ -50,7 +50,7 @@ import (
50
50
const (
51
51
defaultSyncTimeout = 60 * time .Second
52
52
defaultOperationTimeout = 10 * time .Minute
53
- checkControlledPodsInterval = 5 * time .Second
53
+ defaultRefreshInterval = 5 * time .Second
54
54
informerSyncTimeout = time .Minute
55
55
waitForControlledPodsRunningName = "WaitForControlledPodsRunning"
56
56
@@ -216,11 +216,15 @@ func (w *waitForControlledPodsRunningMeasurement) Execute(config *measurement.Co
216
216
}
217
217
return nil , w .start ()
218
218
case "gather" :
219
+ refreshInterval , err := util .GetDurationOrDefault (config .Params , "refreshInterval" , defaultRefreshInterval )
220
+ if err != nil {
221
+ return nil , err
222
+ }
219
223
syncTimeout , err := util .GetDurationOrDefault (config .Params , "syncTimeout" , defaultSyncTimeout )
220
224
if err != nil {
221
225
return nil , err
222
226
}
223
- ps , err := w .gather (syncTimeout )
227
+ ps , err := w .gather (refreshInterval , syncTimeout )
224
228
summary := createSummary (ps )
225
229
return summary , err
226
230
case "stop" :
@@ -284,7 +288,7 @@ func (w *waitForControlledPodsRunningMeasurement) start() error {
284
288
return informer .StartAndSync (i , w .stopCh , informerSyncTimeout )
285
289
}
286
290
287
- func (w * waitForControlledPodsRunningMeasurement ) gather (syncTimeout time.Duration ) ([]failedPod , error ) {
291
+ func (w * waitForControlledPodsRunningMeasurement ) gather (refreshInterval time. Duration , syncTimeout time.Duration ) ([]failedPod , error ) {
288
292
klog .V (2 ).Infof ("%v: waiting for controlled pods measurement..." , w )
289
293
if ! w .isRunning {
290
294
return nil , fmt .Errorf ("metric %s has not been started" , w )
@@ -315,7 +319,7 @@ func (w *waitForControlledPodsRunningMeasurement) gather(syncTimeout time.Durati
315
319
defer w .lock .Unlock ()
316
320
return w .opResourceVersion >= maxResourceVersion && objectKeys .Equal (w .objectKeys ), nil
317
321
}
318
- if err := wait .Poll (checkControlledPodsInterval , syncTimeout , cond ); err != nil {
322
+ if err := wait .Poll (refreshInterval , syncTimeout , cond ); err != nil {
319
323
return nil , fmt .Errorf ("timed out while waiting for controlled pods: %v" , err )
320
324
}
321
325
0 commit comments