fix update pull time issue (#12601)

fixes #12574

let the tag ID as 0 when tags array is empty when to update pull time

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2020-07-28 12:15:46 +08:00 committed by GitHub
parent a2112bfa40
commit 588bf475ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,9 @@ func (a *Handler) updatePullTime(ctx context.Context, event *event.ArtifactEvent
if err != nil {
log.Infof("failed to list tags when to update pull time, %v", err)
} else {
tagID = tags[0].ID
if len(tags) != 0 {
tagID = tags[0].ID
}
}
}
if err := artifact.Ctl.UpdatePullTime(ctx, event.Artifact.ID, tagID, time.Now()); err != nil {