Merge pull request #540 from thockin/v4-fail-count-logging

v4: Clean up fail-count logging
This commit is contained in:
Kubernetes Prow Robot 2022-07-02 03:51:24 -07:00 committed by GitHub
commit bd2bfcb736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -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())