Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
retry app rm on conflict (#2292)
Browse files Browse the repository at this point in the history
Signed-off-by: Oscar Ward <[email protected]>
  • Loading branch information
Oscar Ward authored Oct 25, 2023
1 parent 5439402 commit 86e5ba2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/cli/rm_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import (
"strings"
"time"

v1 "github.com/acorn-io/runtime/pkg/apis/api.acorn.io/v1"
"github.com/acorn-io/runtime/pkg/prompt"
"github.com/pterm/pterm"
"github.com/sirupsen/logrus"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/client-go/util/retry"

"github.com/acorn-io/runtime/pkg/client"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -123,7 +125,11 @@ func deleteOthers(ctx context.Context, c client.Client, arg string) (bool, error
}

func removeAcorn(ctx context.Context, c client.Client, arg string, ignoreCleanup, wait bool) error {
app, err := c.AppDelete(ctx, arg)
var app *v1.App
err := retry.RetryOnConflict(retry.DefaultRetry, func() (err error) {
app, err = c.AppDelete(ctx, arg)
return
})
if err != nil {
return fmt.Errorf("deleting app %s: %w", arg, err)
}
Expand Down

0 comments on commit 86e5ba2

Please sign in to comment.