mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-09 06:04:12 +00:00
Don't download the same files twice in one cycle.
This commit is contained in:
Vendored
+9
-2
@@ -186,14 +186,21 @@ func (repo *RemoteRepo) Download(d utils.Downloader, packageCollection *PackageC
|
||||
|
||||
// Download all package files
|
||||
ch := make(chan error, list.Len())
|
||||
queued := make(map[string]bool, 1024)
|
||||
count := 0
|
||||
|
||||
err = list.ForEach(func(p *Package) error {
|
||||
list, err := p.DownloadList(packageRepo)
|
||||
|
||||
for _, pair := range list {
|
||||
d.Download(repo.PackageURL(pair[0]).String(), pair[1], ch)
|
||||
count++
|
||||
key := pair[0] + "-" + pair[1]
|
||||
_, found := queued[key]
|
||||
if !found {
|
||||
d.Download(repo.PackageURL(pair[0]).String(), pair[1], ch)
|
||||
count++
|
||||
} else {
|
||||
queued[key] = true
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user