-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add retry logic for image copying #63
Conversation
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.
LGTM, other than the minor 'return nil' nit, and the somewhat more substantial question of whether we want to retry for all errors or just the "blob unknown" case (see my comment for more details)
if strings.Contains(err.Error(), "blob unknown to registry") { | ||
log.Warn(fmt.Sprintf("encountered `blob unknown to registry error` for image %s", src)) | ||
} | ||
log.Info(fmt.Sprintf("attempt #%v failed, waiting %vs and then retrying", i, retryWait)) |
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.
We're retrying on any error, not just "blob unknown to registry". Is that by design? This means we'll retry if the registry is down, among other things. If it's an error that takes a timeout to reach, we'll hit 5 timeouts.
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.
I agree this isn't ideal but figured it was the easiest approach. I took this approach since I noticed the Docker CLI does the same and containers/image has a conversation to handle this specifically around the 429 HTTP code: containers/image#703.
They do an exponential backoff for 5 retries it looks like.
I would prefer to dig more into the specific errors this can return and make determinations on it but would need more time to do that properly.
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.
Added a TODO to come back to this
* Add retry logic for image copying * Remove unnecessary break * Change to 5 retries * Use proper format for prints * Return empty byte array * Add todo (cherry picked from commit b7c9bbd)
No description provided.