mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Use batched writes to DB when saving packages from the mirror.
This commit is contained in:
Vendored
+6
@@ -319,12 +319,18 @@ func (repo *RemoteRepo) Download(d utils.Downloader, packageCollection *PackageC
|
||||
|
||||
d.GetProgress().InitBar(int64(list.Len()), false)
|
||||
|
||||
packageCollection.db.StartBatch()
|
||||
|
||||
// Save package meta information to DB
|
||||
err := list.ForEach(func(p *Package) error {
|
||||
d.GetProgress().AddBar(1)
|
||||
return packageCollection.Update(p)
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to save packages to db: %s", err)
|
||||
}
|
||||
|
||||
err = packageCollection.db.FinishBatch()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to save packages to db: %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user