Improve resilience when handling execution errors in pmctl

This commit is contained in:
Daniel 2020-06-20 16:08:50 +02:00
parent bb2cbdb5c1
commit 7926962567

View file

@ -185,8 +185,16 @@ func run(cmd *cobra.Command, opts *Options) (err error) {
log.Println("error seems to be permanent, giving up...")
return err
}
// resilience
time.Sleep(time.Duration(tries) * 2 * time.Second)
if tries >= 2 {
// try updating
updateRegistryIndex()
}
log.Println("trying again...")
case tryAgain && err == nil:
// reset error count
tries = 0
// upgrade
log.Println("restarting by request...")
// update index