Skip to content

Commit

Permalink
safe app deletion always retry on any error (#567)
Browse files Browse the repository at this point in the history
* safe app deletion always retry on any error

* remove unused import
  • Loading branch information
Cocossoul authored Oct 22, 2024
1 parent c38276a commit e6b0d2e
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions cloudfoundry/managers/v3appdeployers/bluegreen_strategy_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"io/ioutil"
"log"
"regexp"
"time"

"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
Expand Down Expand Up @@ -467,16 +466,11 @@ func SafeAppDeletion(client ccv3.Client, appGuid string, remainingAttempts int)

// error handling
if err != nil {
// https://github.com/cloudfoundry/cloud_controller_ng/issues/3589 -> Delete app when bound to service fails with async service brokers -> Retry that
specialError, _ := regexp.MatchString("An operation for the service binding between app .* and service instance .* is in progress.", err.Error())
if specialError {
if remainingAttempts > 0 {
time.Sleep(5 * time.Second)
return SafeAppDeletion(client, appGuid, remainingAttempts-1)
}
return fmt.Errorf("Retries for app deletion exhausted: %+v", err)
if remainingAttempts > 0 {
time.Sleep(5 * time.Second)
return SafeAppDeletion(client, appGuid, remainingAttempts-1)
}
return err
return fmt.Errorf("Retries for app deletion exhausted: %+v", err)
}

return nil
Expand Down

0 comments on commit e6b0d2e

Please sign in to comment.