mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Solving progress not safe issue for api
Progress is not safe so for api its always nil and code needs to take care of this
This commit is contained in:
committed by
Lorenzo Bolla
parent
1c7c07ace7
commit
25d7d7c037
@@ -550,12 +550,14 @@ func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.
|
||||
}
|
||||
}
|
||||
err = repo.packageList.Add(p)
|
||||
if _, ok := err.(*PackageConflictError); ok {
|
||||
if progress != nil {
|
||||
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
|
||||
if err != nil {
|
||||
if _, ok := err.(*PackageConflictError); ok {
|
||||
if progress != nil {
|
||||
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
|
||||
}
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ func retryableError(err error) bool {
|
||||
|
||||
func (downloader *downloaderImpl) newRequest(ctx context.Context, method, url string) (*http.Request, error) {
|
||||
req, err := http.NewRequest(method, url, nil)
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, url)
|
||||
}
|
||||
@@ -230,7 +231,11 @@ func (downloader *downloaderImpl) download(req *http.Request, url, destination s
|
||||
defer outfile.Close()
|
||||
|
||||
checksummer := utils.NewChecksumWriter()
|
||||
writers := []io.Writer{outfile, downloader.aggWriter}
|
||||
writers := []io.Writer{outfile}
|
||||
|
||||
if downloader.progress != nil {
|
||||
writers = append(writers, downloader.progress)
|
||||
}
|
||||
|
||||
if expected != nil {
|
||||
writers = append(writers, checksummer)
|
||||
|
||||
Reference in New Issue
Block a user