Skip to content

Commit

Permalink
Resumed artifact installation fails (#42)
Browse files Browse the repository at this point in the history
[#41] Resumed artifact installation fails

- fixed resuming of fully downloaded artifacts

Signed-off-by: Georgi Boyvalenkov <[email protected]>
  • Loading branch information
gboyvalenkov-bosch authored Sep 27, 2022
1 parent 071b39b commit 73758d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/storage/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ func downloadArtifact(to string, artifact *Artifact, progress progressBytes, ser

func resume(to string, offset int64, artifact *Artifact, progress progressBytes, serverCert string, retryCount int,
retryInterval time.Duration, done chan struct{}) (int64, error) {
if offset == int64(artifact.Size) {
logger.Infof("validating previously downloaded artifact: %s", to)
if err := validate(to, artifact.HashType, artifact.HashValue); err == nil || retryCount == 0 {
return 0, err
}
offset = 0 // retry download otherwise
retryCount--
time.Sleep(time.Duration(retryInterval))
}
// Send the HTTP request and get its response.
source, remainingRetries, resumeSupported, err := openResource(artifact, offset, serverCert, retryCount, retryInterval)
if err != nil {
Expand Down

0 comments on commit 73758d6

Please sign in to comment.