Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/runners/mcp/projecterrors/projecterrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ func (runner *ProjectErrorsRunner) Run(params *Params) error {
func CheckDependencyFixes(auth *authentication.Auth, failedArtifacts []*buildplan.Artifact) (map[strfmt.UUID]bool, error) {
fixed := make(map[strfmt.UUID]bool)
for _, artifact := range failedArtifacts {
latest, err := model.FetchLatestRevisionTimeStamp(auth)
if err != nil {
return nil, fmt.Errorf("Failed to fetch latest timestamp: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fixed := make(map[strfmt.UUID]bool)
for _, artifact := range failedArtifacts {
latest, err := model.FetchLatestRevisionTimeStamp(auth)
if err != nil {
return nil, fmt.Errorf("Failed to fetch latest timestamp: %w", err)
}
fixed := make(map[strfmt.UUID]bool)
latest, err := model.FetchLatestRevisionTimeStamp(auth)
if err != nil {
return nil, fmt.Errorf("Failed to fetch latest timestamp: %w", err)
}
for _, artifact := range failedArtifacts {

Avoid doing API calls within a for loop if not needed.

// TODO: Query multiple artifacts at once to reduce API calls, improving performance.
latestRevision, err := model.GetIngredientByNameAndVersion(
artifact.Ingredients[0].Namespace, artifact.Name(), artifact.Version(), nil, auth)
artifact.Ingredients[0].Namespace, artifact.Name(), artifact.Version(), &latest, auth)
if err != nil {
return nil, fmt.Errorf("error searching ingredient: %w", err)
}
Expand Down
Loading