mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Merge pull request #56 from safing/feature/reload-indexes-when-restarting
Reload indexes when restarting
This commit is contained in:
commit
1ae770cb23
2 changed files with 18 additions and 11 deletions
|
@ -194,17 +194,7 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
|||
Beta: false,
|
||||
})
|
||||
|
||||
err = registry.LoadIndexes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = registry.ScanStorage("")
|
||||
if err != nil {
|
||||
log.Printf("WARNING: error during storage scan: %s\n", err)
|
||||
}
|
||||
|
||||
registry.SelectVersions()
|
||||
updateRegistryIndex()
|
||||
}
|
||||
|
||||
// logs and warning
|
||||
|
@ -225,3 +215,17 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func updateRegistryIndex() {
|
||||
err := registry.LoadIndexes()
|
||||
if err != nil {
|
||||
log.Printf("WARNING: error loading indexes: %s\n", err)
|
||||
}
|
||||
|
||||
err = registry.ScanStorage("")
|
||||
if err != nil {
|
||||
log.Printf("WARNING: error during storage scan: %s\n", err)
|
||||
}
|
||||
|
||||
registry.SelectVersions()
|
||||
}
|
||||
|
|
|
@ -191,6 +191,9 @@ func run(cmd *cobra.Command, opts *Options) (err error) {
|
|||
case tryAgain && err == nil:
|
||||
// upgrade
|
||||
log.Println("restarting by request...")
|
||||
// update index
|
||||
log.Println("checking versions...")
|
||||
updateRegistryIndex()
|
||||
case !tryAgain && err != nil:
|
||||
// fatal error
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue