mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Fix temporary contents DB being left behind after publishing
NB: Go `defer` order execution is reverse to the order `defer` statements are executed. So before the change, `Drop()` was called before `Close()`, which was no-op. Change that to explicit order in single func, print errors if they happen.
This commit is contained in:
@@ -473,8 +473,17 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tempDB.Close()
|
||||
defer tempDB.Drop()
|
||||
defer func() {
|
||||
var e error
|
||||
e = tempDB.Close()
|
||||
if e != nil && progress != nil {
|
||||
progress.Printf("failed to close temp DB: %s", err)
|
||||
}
|
||||
e = tempDB.Drop()
|
||||
if e != nil && progress != nil {
|
||||
progress.Printf("failed to drop temp DB: %s", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if progress != nil {
|
||||
progress.Printf("Loading packages...\n")
|
||||
|
||||
Reference in New Issue
Block a user