Skip to content

Commit

Permalink
fix(api): Send only the 5 latest runs for /layers
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopadok committed Feb 9, 2024
1 parent 59983b6 commit 0e68118
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions internal/server/api/layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,17 @@ func (a *API) getLayerRunInfo(layer configv1alpha1.TerraformLayer) (layerRunning
return
}
}
latestRuns = append(latestRuns, run{
ID: string(r.UID),
Name: r.Name,
Namespace: r.Namespace,
Action: r.Spec.Action,
Status: r.Status.State,
LastRun: r.Status.LastRun,
Retries: r.Status.Retries,
})
if (len(runs.Items)-1-i) < 5 {
latestRuns = append(latestRuns, run{
ID: string(r.UID),
Name: r.Name,
Namespace: r.Namespace,
Action: r.Spec.Action,
Status: r.Status.State,
LastRun: r.Status.LastRun,
Retries: r.Status.Retries,
})
}
}
return
}
Expand Down

0 comments on commit 0e68118

Please sign in to comment.