Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous code cleanup #147

Merged
merged 4 commits into from
Oct 19, 2021
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
Prev Previous commit
Remove unnecessary unboxing
basil committed Oct 19, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bf99655f7788ad900d4e81182341087fa14602fc
Original file line number Diff line number Diff line change
@@ -85,8 +85,8 @@ private CauseOfBlockage canTakeImpl(Node node, Task task) {
}
if (tjp != null) {
if (tjp.getThrottleOption().equals("project")) {
if (tjp.getMaxConcurrentPerNode().intValue() > 0) {
int maxConcurrentPerNode = tjp.getMaxConcurrentPerNode().intValue();
if (tjp.getMaxConcurrentPerNode() > 0) {
int maxConcurrentPerNode = tjp.getMaxConcurrentPerNode();
int runCount = buildsOfProjectOnNode(node, task);

// This would mean that there are as many or more builds currently running than are allowed.
@@ -121,7 +121,7 @@ private CauseOfBlockage throttleCheckForCategoriesOnNode(Node node, Jenkins jenk
int runCount = 0;
// Max concurrent per node for category
int maxConcurrentPerNode = getMaxConcurrentPerNodeBasedOnMatchingLabels(
node, category, category.getMaxConcurrentPerNode().intValue());
node, category, category.getMaxConcurrentPerNode());
if (maxConcurrentPerNode > 0) {
for (Task catTask : categoryTasks) {
if (jenkins.getQueue().isPending(catTask)) {
@@ -234,8 +234,8 @@ private CauseOfBlockage canRunImpl(Task task, ThrottleJobProperty tjp, List<Stri
}
if (tjp != null) {
if (tjp.getThrottleOption().equals("project")) {
if (tjp.getMaxConcurrentTotal().intValue() > 0) {
int maxConcurrentTotal = tjp.getMaxConcurrentTotal().intValue();
if (tjp.getMaxConcurrentTotal() > 0) {
int maxConcurrentTotal = tjp.getMaxConcurrentTotal();
int totalRunCount = buildsOfProjectOnAllNodes(task);

if (totalRunCount >= maxConcurrentTotal) {
@@ -263,8 +263,8 @@ private CauseOfBlockage throttleCheckForCategoriesAllNodes(Jenkins jenkins, @Non

// Double check category itself isn't null
if (category != null) {
if (category.getMaxConcurrentTotal().intValue() > 0) {
int maxConcurrentTotal = category.getMaxConcurrentTotal().intValue();
if (category.getMaxConcurrentTotal() > 0) {
int maxConcurrentTotal = category.getMaxConcurrentTotal();
int totalRunCount = 0;

for (Task catTask : categoryTasks) {
@@ -668,7 +668,7 @@ private int getMaxConcurrentPerNodeBasedOnMatchingLabels(
for(LabelAtom aNodeLabel: nodeLabels) {
String nodeLabel = aNodeLabel.getDisplayName();
if(nodeLabel.equals(throttledNodeLabel)) {
maxConcurrentPerNodeLabeledIfMatch = nodeLabeledPair.getMaxConcurrentPerNodeLabeled().intValue();
maxConcurrentPerNodeLabeledIfMatch = nodeLabeledPair.getMaxConcurrentPerNodeLabeled();
LOGGER.log(Level.FINE, "node labels match; => maxConcurrentPerNode'' = {0}", maxConcurrentPerNodeLabeledIfMatch);
nodeLabelsMatch = true;
break;