Skip to content

Commit

Permalink
chore: block for controller to undeploy before delete
Browse files Browse the repository at this point in the history
  • Loading branch information
heiruwu committed Aug 18, 2023
1 parent dd6f100 commit 2481315
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"

"cloud.google.com/go/longrunning/autogen/longrunningpb"
"github.com/go-redis/redis/v9"
Expand Down Expand Up @@ -706,6 +707,13 @@ func (s *service) DeleteModel(ctx context.Context, owner string, modelID string)
}
}

for state.String() == modelPB.Model_STATE_ONLINE.String() {
if state, err = s.GetResourceState(ctx, modelInDB.UID); err != nil {
return err
}
time.Sleep(100 * time.Millisecond)

Check warning on line 714 in pkg/service/service.go

View check run for this annotation

Codecov / codecov/patch

pkg/service/service.go#L710-L714

Added lines #L710 - L714 were not covered by tests
}

if err := s.DeleteResourceState(ctx, modelInDB.UID); err != nil {
return err
}
Expand Down

0 comments on commit 2481315

Please sign in to comment.