Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Nov 14, 2023
1 parent 198d71d commit c6aa11c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/service-waiter/cmd/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,18 @@ func startWaitFeatureFlag(ctx context.Context, timeout time.Duration) {
getShouldSkipComponentWaiter := func() {
startTime := time.Now()
value, isActualValue, fetchTimes := ActualWaitFeatureFlag(featureFlagCtx, client, defaultSkip)
avgTime := time.Since(startTime) / time.Duration(fetchTimes)
avgTime := time.Duration(0)
if fetchTimes > 0 {
avgTime = time.Since(startTime) / time.Duration(fetchTimes)
}
log.WithField("fetchTimes", fetchTimes).WithField("avgTime", avgTime).WithField("isActualValue", isActualValue).WithField("value", value).Info("get final value of feature flag")
shouldSkipComponentWaiter = value
metrics.AddSkipComponentsCounter(componentCmdOpt.ideMetricsHost, strconv.FormatBool(shouldSkipComponentWaiter), isActualValue)
}
for !shouldSkipComponentWaiter {
if featureFlagCtx.Err() != nil {
break
}
getShouldSkipComponentWaiter()
time.Sleep(1 * time.Second)
}
Expand Down

0 comments on commit c6aa11c

Please sign in to comment.