-
Notifications
You must be signed in to change notification settings - Fork 85
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
updaters: handle "unchanged" better #201
Conversation
still need to spot-check the other updaters |
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
@@ -58,18 +58,16 @@ func (u *Updater) Fetch(ctx context.Context, hint driver.Fingerprint) (io.ReadCl | |||
|
|||
var r io.Reader = res.Body | |||
if _, err := io.Copy(tf, r); err != nil { | |||
tf.Close() |
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.
tf.Close() | |
if tf != nil { | |
tf.Close() | |
} |
I've gotten into the habit of checking nil on these things first, may not be necessary.
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.
In this case, tmp.File works such that if it didn't return an error, it can't return a nil pointer.
} | ||
} | ||
|
||
func (f *fingerprint) From(h http.Header) { |
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.
FromHeader
?
The debian and ubunut updaters weren't actually checking the passed-in fingerprint, which was resulting in spurious updates in the database.
The alpine updater wasn't using an etag, which the remote server seems to support, so this change uses that.