Skip to content
Permalink
Browse files
[JENKINS-22639] Don't record changes to AbstractCloudSlaves or Epheme…
…ralNodes

This can result in high load when there are nodes coming online and offline quickly.
  • Loading branch information
recampbell committed Apr 15, 2014
1 parent 3a1b0d9 commit e4103327c5143bbe3c0955cf29bcffd342b6251e
Showing with 15 additions and 4 deletions.
  1. +15 −4 src/main/java/hudson/plugins/jobConfigHistory/ComputerHistoryListener.java
@@ -5,6 +5,8 @@
package hudson.plugins.jobConfigHistory;

import hudson.Extension;
import hudson.slaves.EphemeralNode;
import hudson.slaves.AbstractCloudSlave;
import hudson.slaves.ComputerListener;
import hudson.model.Node;
import hudson.model.Slave;
@@ -49,19 +51,28 @@ public void onConfigurationChange() {
*/
private void onAdd() {
for (Node node : Jenkins.getInstance().getNodes()) {
if (!nodes.contains(node)) {
if (!nodes.contains(node) && isTracked(node)) {
switchHistoryDao(node).createNewNode(node);
return;
}
}
}

/**
* Is this node likely to be important to the user?
* @param node
*/
private boolean isTracked(Node node) {
return node != null &&
! (node instanceof AbstractCloudSlave || node instanceof EphemeralNode);
}

/**
* If a slave get removed.
*/
private void onRemove() {
for (Node node : nodes) {
if (!Jenkins.getInstance().getNodes().contains(node)) {
if (!Jenkins.getInstance().getNodes().contains(node) && isTracked(node)) {
switchHistoryDao(node).deleteNode(node);
return;
}
@@ -87,7 +98,7 @@ private void onChange() {
private void onRename() {
Node originalNode = null;
for (Node node : nodes) {
if (!Jenkins.getInstance().getNodes().contains(node)) {
if (!Jenkins.getInstance().getNodes().contains(node) && isTracked(node)) {
originalNode = node;
}
}
@@ -97,7 +108,7 @@ private void onRename() {
}
Node newNode = null;
for (Node node : Jenkins.getInstance().getNodes()) {
if (!nodes.contains(node)) {
if (!nodes.contains(node) && isTracked(node)) {
newNode = node;
}
}

0 comments on commit e410332

Please sign in to comment.