Skip to content

Commit

Permalink
Fix delete condition
Browse files Browse the repository at this point in the history
Signed-off-by: Sergen Yalçın <[email protected]>
  • Loading branch information
sergenyalcin authored Nov 10, 2023
1 parent bd014e9 commit 9cb226a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controller/external_async_nofork.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ func (n *noForkAsyncExternal) Update(_ context.Context, mg xpresource.Managed) (
}

func (n *noForkAsyncExternal) Delete(_ context.Context, mg xpresource.Managed) error {
if !n.opTracker.LastOperation.MarkStart("delete") {
switch {
case n.opTracker.LastOperation.Type == "delete":
n.opTracker.logger.Debug("The previous delete operation is still ongoing", "tfID", n.opTracker.GetTfID())
return nil
case !n.opTracker.LastOperation.MarkStart("delete"):
return errors.Errorf("%s operation that started at %s is still running", n.opTracker.LastOperation.Type, n.opTracker.LastOperation.StartTime().String())
}

Expand Down

0 comments on commit 9cb226a

Please sign in to comment.