-
Notifications
You must be signed in to change notification settings - Fork 213
Bug 1927168: pkg/cvo/sync_worker: Increment Attempt on failed reconciliation #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,7 @@ type SyncWork struct { | |
| // Completed is the number of times in a row we have synced this payload | ||
| Completed int | ||
| // Attempt is incremented each time we attempt to sync a payload and reset | ||
| // when we change Generation/Desired. | ||
| // when we change Generation/Desired or successfully synchronize. | ||
| Attempt int | ||
| } | ||
|
|
||
|
|
@@ -349,7 +349,8 @@ func (w *SyncWorker) Start(ctx context.Context, maxWorkers int, cvoOptrName stri | |
| } | ||
| } | ||
| next = time.After(wait.Jitter(interval, 0.2)) | ||
|
|
||
| work.Completed = 0 | ||
| work.Attempt++ | ||
| utilruntime.HandleError(fmt.Errorf("unable to synchronize image (waiting %s): %v", interval, err)) | ||
| continue | ||
| } | ||
|
|
@@ -358,6 +359,7 @@ func (w *SyncWorker) Start(ctx context.Context, maxWorkers int, cvoOptrName stri | |
| } | ||
|
|
||
| work.Completed++ | ||
| work.Attempt = 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| work.State = payload.ReconcilingPayload | ||
| next = time.After(w.minimumReconcileInterval) | ||
| } | ||
|
|
@@ -416,20 +418,10 @@ func (w *SyncWorker) calculateNext(work *SyncWork) bool { | |
| // the state Update() calculated (to allow us to start in reconciling) | ||
| if work.Empty() { | ||
| work.State = w.work.State | ||
| work.Attempt = 0 | ||
| } else if changed { | ||
| work.State = payload.UpdatingPayload | ||
| } | ||
| // always clear the completed variable if we are not reconciling | ||
| if work.State != payload.ReconcilingPayload { | ||
| work.Completed = 0 | ||
| } | ||
|
|
||
| // track how many times we have tried the current payload in the current | ||
| // state | ||
| if changed || w.work.State != work.State { | ||
| work.Attempt = 0 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not clear why we need to make Attempt= 0 here? Because it means
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to reset the count, because we are about to begin our first attempt at the new target. |
||
| } else { | ||
| work.Attempt++ | ||
| } | ||
|
|
||
| if w.work != nil { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍