Skip to content

Commit

Permalink
Don't use defer for streak length reporting
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Newton <[email protected]>
  • Loading branch information
Tom-Newton committed Apr 3, 2024
1 parent c21ded6 commit faca8b9
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions flytepropeller/pkg/controller/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ func (p *Propeller) Handle(ctx context.Context, namespace, name string) error {
}

streak := 0
defer p.metrics.StreakLength.Add(ctx, float64(streak))

maxLength := p.cfg.MaxStreakLength
if maxLength <= 0 {
Expand All @@ -239,16 +238,15 @@ func (p *Propeller) Handle(ctx context.Context, namespace, name string) error {

for streak = 0; streak < maxLength; streak++ {
w, err = p.streak(ctx, w, wfClosureCrdFields)
if err != nil {
return err
} else if w == nil {
if err != nil || w == nil {
break
}

logger.Infof(ctx, "FastFollow Enabled. Detected State change, we will try another round. StreakLength [%d]", streak)
}
logger.Infof(ctx, "Streak ended at [%d]/Max: [%d]", streak, maxLength)
return nil
p.metrics.StreakLength.Add(ctx, float64(streak))
return err
}

// parseWorkflowClosureCrdFields attempts to retrieve offloaded static workflow closure data from the specified
Expand Down

0 comments on commit faca8b9

Please sign in to comment.