Skip to content

Commit

Permalink
Fix logging for next run delay
Browse files Browse the repository at this point in the history
We were logging the spec interval duration, which was incorrect:

1. On failures, which use exponential backoff
2. On dependency not ready, which uses a separately defined static interval.

This changes to log result.RequeueAfter directly when set.
  • Loading branch information
seaneagan committed Sep 28, 2020
1 parent 9b1c951 commit 30a8f93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions controllers/helmrelease_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ func (r *HelmReleaseReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error)
}

// Log reconciliation duration
log.Info(fmt.Sprintf("reconcilation finished in %s, next run in %s",
time.Now().Sub(start).String(),
hr.Spec.Interval.Duration.String(),
))
durationMsg := fmt.Sprintf("reconcilation finished in %s", time.Now().Sub(start).String())
if result.RequeueAfter > 0 {
durationMsg = fmt.Sprintf("%s, next run in %s", durationMsg, result.RequeueAfter.String())
}
log.Info(durationMsg)

return result, err
}
Expand Down

0 comments on commit 30a8f93

Please sign in to comment.