Skip to content

Commit

Permalink
Make it work with defer
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 4, 2024
1 parent f13e62d commit a80f1df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flytepropeller/pkg/controller/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ func (p *Propeller) Handle(ctx context.Context, namespace, name string) error {
}

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

maxLength := p.cfg.MaxStreakLength
if maxLength <= 0 {
Expand All @@ -238,15 +239,16 @@ 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 || w == nil {
if err != nil {
return err
} else if 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)
p.metrics.StreakLength.Add(ctx, float64(streak))
return err
return nil
}

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

0 comments on commit a80f1df

Please sign in to comment.