Skip to content

Commit

Permalink
Improved logging for NodeProvisioner.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jun 18, 2019
1 parent bc40ab3 commit ee9edf8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/java/hudson/slaves/NodeProvisioner.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,12 @@ public void suggestReviewNow() {
lastSuggestedReview = System.currentTimeMillis();
Computer.threadPoolForRemoting.submit(new Runnable() {
public void run() {
LOGGER.fine(() -> "running suggested review for " + label);
update();
}
});
} else {
LOGGER.fine(() -> "ignoring suggested review for " + label);
}
}

Expand All @@ -188,6 +191,7 @@ public void run() {
* instance of this provisioner is running at a time) and then a lock on {@link Queue#lock}
*/
private void update() {
long start = LOGGER.isLoggable(Level.FINER) ? System.nanoTime() : 0;
provisioningLock.lock();
try {
lastSuggestedReview = System.currentTimeMillis();
Expand Down Expand Up @@ -327,6 +331,9 @@ public void run() {
} finally {
provisioningLock.unlock();
}
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.finer(() -> "ran update on " + label + " in " + (System.nanoTime() - start) / 1_000_000 + "ms");
}
}


Expand Down

0 comments on commit ee9edf8

Please sign in to comment.