Skip to content
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

fix: gcb api throttling retry backoff not implemented correctly #6023

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/skaffold/build/gcb/cloud_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ watch:
logrus.Debugf("current offset %d", offset)
backoff := NewStatusBackoff()
if waitErr := wait.Poll(backoff.Duration, RetryTimeout, func() (bool, error) {
backoff.Step()
time.Sleep(backoff.Step())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poll doesn't seem the right function here: it does a fixed wait. And we're not checking the context here either.

wait.ExponentialBackoffWithContext() looks like the function we should be using?

Honestly, this whole loop should be refactored into a set of methods. It's hard to trace the logic, and I worry that there's a chance that we cut off the logs (do we know we retrieve the remainder of the logs when cb.Status == StatusSuccess or StatusFailure?

And shouldn't we delete the source archive on failure or any other termination condition?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you are refactoring it in #6005 (where is my brain :-D)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya 😅 I thought to just patch this bug in the interim.

cb, err = cbclient.Projects.Builds.Get(projectID, remoteID).Do()
if err == nil {
return true, nil
Expand Down