Skip to content

Commit 531c94c

Browse files
committed
fix golangci-lint errors in application_service
Signed-off-by: Noah Masoud <noah.masoud@ibm.com>
1 parent c24ac33 commit 531c94c

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

ai-services/internal/pkg/catalog/apiserver/repository/application_service.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type ApplicationService struct {
2222
provider *catalog.CatalogProvider
2323
}
2424

25-
// response type for response
25+
// DeleteApplicationResponse is the response body for a delete application request.
2626
type DeleteApplicationResponse struct {
2727
ID string `json:"id"`
2828
Status string `json:"status"`
@@ -240,14 +240,11 @@ func (s *ApplicationService) DeleteApplication(ctx context.Context, id uuid.UUID
240240
}, nil
241241
}
242242

243-
// performDeletion carries out the async cascade deletion for an application
244-
// collect component IDs referenced by this app's services
245-
// identify which components become orphaned
246-
// delete the application CASCADE removes services + service_dependencies
247-
// delete orphaned components
248-
// TODO: teardown pods/containers once Create flow is ready skipCleanup flag
243+
// performDeletion carries out the async cascade deletion for an application.
244+
//
245+
//nolint:cyclop
249246
func (s *ApplicationService) performDeletion(ctx context.Context, appID uuid.UUID, services []models.Service, skipCleanup bool) {
250-
// Step 1: collect component IDs and service IDs being deleted
247+
_ = skipCleanup // reserved for pod teardown once Create flow is ready
251248
serviceIDs := make(map[uuid.UUID]bool, len(services))
252249
componentCandidates := make(map[uuid.UUID]bool)
253250

@@ -256,7 +253,7 @@ func (s *ApplicationService) performDeletion(ctx context.Context, appID uuid.UUI
256253

257254
deps, err := s.depRepo.GetDependenciesByServiceID(ctx, svc.ID)
258255
if err != nil {
259-
s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
256+
_ = s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
260257
fmt.Sprintf("failed to get dependencies for service %s: %s", svc.ID, err))
261258
return
262259
}
@@ -273,7 +270,7 @@ func (s *ApplicationService) performDeletion(ctx context.Context, appID uuid.UUI
273270
for componentID := range componentCandidates {
274271
consumers, err := s.depRepo.GetServicesByDependency(ctx, componentID, models.DependencyTypeComponent)
275272
if err != nil {
276-
s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
273+
_ = s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
277274
fmt.Sprintf("failed to check consumers of component %s: %s", componentID, err))
278275
return
279276
}
@@ -292,7 +289,7 @@ func (s *ApplicationService) performDeletion(ctx context.Context, appID uuid.UUI
292289
}
293290

294291
if err := s.appRepo.Delete(ctx, appID); err != nil {
295-
s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
292+
_ = s.appRepo.UpdateStatus(ctx, appID, models.ApplicationStatusError,
296293
fmt.Sprintf("failed to delete application: %s", err))
297294
return
298295
}

0 commit comments

Comments
 (0)