Merge pull request #540 from thockin/v4-fail-count-logging
v4: Clean up fail-count logging
This commit is contained in:
commit
bd2bfcb736
|
|
@ -628,16 +628,15 @@ func main() {
|
|||
}
|
||||
|
||||
if changed, hash, err := git.SyncRepo(ctx); err != nil {
|
||||
failCount++
|
||||
updateSyncMetrics(metricKeyError, start)
|
||||
if *flMaxSyncFailures != -1 && failCount >= *flMaxSyncFailures {
|
||||
if *flMaxSyncFailures != -1 && failCount > *flMaxSyncFailures {
|
||||
// Exit after too many retries, maybe the error is not recoverable.
|
||||
log.Error(err, "too many failures, aborting", "failCount", failCount)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
failCount++
|
||||
log.Error(err, "unexpected error syncing repo, will retry")
|
||||
log.V(0).Info("waiting before retrying", "waitTime", flPeriod.String())
|
||||
log.Error(err, "unexpected error syncing repo, will retry", "failCount", failCount, "waitTime", flPeriod.String())
|
||||
cancel()
|
||||
time.Sleep(*flPeriod)
|
||||
continue
|
||||
|
|
@ -689,6 +688,9 @@ func main() {
|
|||
initialSync = false
|
||||
}
|
||||
|
||||
if failCount > 0 {
|
||||
log.V(5).Info("resetting failure count", "failCount", failCount)
|
||||
}
|
||||
failCount = 0
|
||||
log.DeleteErrorFile()
|
||||
log.V(1).Info("next sync", "waitTime", flPeriod.String())
|
||||
|
|
|
|||
Loading…
Reference in New Issue