Skip to content
Permalink
Browse files

Change .getPreviousBuild() to allow for higher concurrency

Jenkins changed getPreviousBuild() to halt jobs if a previous
build hasn't finished, meaning jobs of variable runtime end up
being serialized:

https://issues.jenkins-ci.org/browse/JENKINS-9913?focusedCommentId=184188&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-184188

This change switches to the latest completed build, allowing
this plugin to work with jobs of variable length.
  • Loading branch information
tim-win committed Mar 18, 2015
1 parent b02759f commit 832e7b50028ca086dd49311ce454e7a19c9a3af9
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/main/java/jenkins/plugins/slack/ActiveNotifier.java
@@ -58,7 +58,7 @@ public void started(AbstractBuild build) {

private void notifyStart(AbstractBuild build, String message) {
AbstractProject<?, ?> project = build.getProject();
AbstractBuild<?, ?> previousBuild = project.getLastBuild().getPreviousBuild();
AbstractBuild<?, ?> previousBuild = project.getLastBuild().getPreviousCompletedBuild();
if (previousBuild == null) {
getSlack(build).publish(message, "good");
} else {
@@ -79,7 +79,7 @@ public void completed(AbstractBuild r) {
Result result = r.getResult();
AbstractBuild<?, ?> previousBuild = project.getLastBuild();
do {
previousBuild = previousBuild.getPreviousBuild();
previousBuild = previousBuild.getPreviousCompletedBuild();
} while (previousBuild != null && previousBuild.getResult() == Result.ABORTED);
Result previousResult = (previousBuild != null) ? previousBuild.getResult() : Result.SUCCESS;
if ((result == Result.ABORTED && jobProperty.getNotifyAborted())

1 comment on commit 832e7b5

@jglick

This comment has been minimized.

Copy link
Member

jglick commented on 832e7b5 Apr 12, 2015

You probably also need to switch to BuildStepMonitor.NONE to see any benefit.

Please sign in to comment.
You can’t perform that action at this time.