Skip to content

Commit

Permalink
Change .getPreviousBuild() to allow for higher concurrency
Browse files Browse the repository at this point in the history
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-Clifford committed Mar 18, 2015
1 parent b02759f commit 832e7b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/jenkins/plugins/slack/ActiveNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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())
Expand Down

1 comment on commit 832e7b5

@jglick
Copy link
Member

@jglick jglick commented on 832e7b5 Apr 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Please sign in to comment.