mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-22 11:08:20 +00:00
Don't download the same files twice in one cycle.
This commit is contained in:
1 parent
d684c87fd1
commit
1268f744ab
4 files changed
+34
-4
No files matched your search
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