Skip to content

Commit

Permalink
PMM-12375 do not call FindService when skipping connection check
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Tymchuk committed Sep 27, 2023
1 parent e36b218 commit 50d5d4b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions managed/services/inventory/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ func (as *AgentsService) AddMySQLdExporter(ctx context.Context, req *inventorypb
return err
}

service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if !req.SkipConnectionCheck {
service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if err = as.cc.CheckConnectionToService(ctx, tx.Querier, service, row); err != nil {
return err
}
Expand Down Expand Up @@ -327,12 +327,12 @@ func (as *AgentsService) AddMongoDBExporter(ctx context.Context, req *inventoryp
return err
}

service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if !req.SkipConnectionCheck {
service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if err = as.cc.CheckConnectionToService(ctx, tx.Querier, service, row); err != nil {
return err
}
Expand Down Expand Up @@ -521,12 +521,12 @@ func (as *AgentsService) AddPostgresExporter(ctx context.Context, req *inventory
return err
}

service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if !req.SkipConnectionCheck {
service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if err = as.cc.CheckConnectionToService(ctx, tx.Querier, service, row); err != nil {
return err
}
Expand Down Expand Up @@ -649,12 +649,12 @@ func (as *AgentsService) AddProxySQLExporter(ctx context.Context, req *inventory
return err
}

service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if !req.SkipConnectionCheck {
service, err := models.FindServiceByID(tx.Querier, req.ServiceId)
if err != nil {
return err
}

if err = as.cc.CheckConnectionToService(ctx, tx.Querier, service, row); err != nil {
return err
}
Expand Down

0 comments on commit 50d5d4b

Please sign in to comment.