Skip to content

Commit

Permalink
Merge pull request #14 from jenkinsci/properties-to-configure-hardcod…
Browse files Browse the repository at this point in the history
…ed-limits

Properties to configure hardcoded limits on APIs - JENKINS-34791
  • Loading branch information
svanoort committed Jun 8, 2016
2 parents 53c9f57 + c5ca0a9 commit 058e4a6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
Expand Up @@ -39,7 +39,7 @@
*/
public class FlowNodeLogExt {

private static long MAX_RETURN_CHARS = 10 * 1024;
private static long MAX_RETURN_CHARS = Integer.getInteger(FlowNodeLogExt.class.getName()+".maxReturnChars", 10 * 1024);

private static final Logger LOGGER = Logger.getLogger(FlowNodeLogExt.class.getName());

Expand Down
Expand Up @@ -42,7 +42,7 @@ public class JobExt {
/**
* Max number of runs per page. Pagination not yet supported.
*/
public static final int RUN_PAGE_SIZE = 20;
public static final int MAX_RUNS_PER_JOB = Integer.getInteger(JobExt.class.getName()+".maxRunsPerJob", 10);

private JobLinks _links;
private String name;
Expand Down Expand Up @@ -127,7 +127,7 @@ public static List<RunExt> create(List<WorkflowRun> runs, String since) {
runsExt.add(runExt);
if (since != null && runExt.getName().equals(since)) {
break;
} else if (runsExt.size() > RUN_PAGE_SIZE) {
} else if (runsExt.size() > MAX_RUNS_PER_JOB) {
// We don't yet support pagination, so no point
// returning a huge list of runs.
break;
Expand Down
Expand Up @@ -49,7 +49,7 @@
*/
public class RunExt {

private static final int MAX_ARTIFACTS_COUNT = 100;
private static int MAX_ARTIFACTS_COUNT = Integer.getInteger(RunExt.class.getName()+".maxArtifactsCount", 100);

private RunLinks _links;
private String id;
Expand Down
Expand Up @@ -43,7 +43,7 @@ public class StageNodeExt extends FlowNodeExt {
private List<AtomFlowNodeExt> stageFlowNodes;

// Limit the size of child nodes returned
static final int MAX_CHILD_NODES = 100;
static final int MAX_CHILD_NODES = Integer.getInteger(StageNodeExt.class.getName()+".maxChildNodes", 100);

@JsonInclude(JsonInclude.Include.NON_NULL)
public List<AtomFlowNodeExt> getStageFlowNodes() {
Expand Down
5 changes: 0 additions & 5 deletions ui/src/main/js/model/runs-stage-grouped.js
Expand Up @@ -257,15 +257,10 @@ function addCompletionEstimates(timedObject, avgDurationMillis, averagedOver) {
}

function RunGroupGenerator(maxRuns) {
this.maxRuns = 10; // Default max of 5 runs per group... arbitrary :)
this.stageData = [];
this.runs = [];
}
RunGroupGenerator.prototype.addRun = function(run) {
if (this.runs.length >= this.maxRuns) {
return false;
}

// Make sure the stage name ordering matches
for (var i = 0; i < run.stages.length; i++) {
var stage = run.stages[i];
Expand Down

0 comments on commit 058e4a6

Please sign in to comment.