From 9f388435d2f8d91984f2417866faa1897074c230 Mon Sep 17 00:00:00 2001 From: Khai Do Date: Thu, 15 Aug 2013 14:46:56 -0700 Subject: [PATCH] remove restriction on slave to run single job at a time The gearman plugin was restricting slaves to runnning only one job at a time even though the slave may have the ability to run multiple jobs in parallel (by having multiple executors). This commit fixes the restriction. Change-Id: I62b4ff9d12474a5885c549f0b532366cb60fcbca --- .../java/hudson/plugins/gearman/StartJobWorker.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/hudson/plugins/gearman/StartJobWorker.java b/src/main/java/hudson/plugins/gearman/StartJobWorker.java index 1c5ce12..dfaa450 100644 --- a/src/main/java/hudson/plugins/gearman/StartJobWorker.java +++ b/src/main/java/hudson/plugins/gearman/StartJobWorker.java @@ -27,21 +27,16 @@ import hudson.model.AbstractProject; import hudson.model.Cause; import hudson.model.Computer; import hudson.model.Hudson; -import hudson.model.Node; -import hudson.model.Project; import hudson.model.Queue; import hudson.model.StringParameterValue; import hudson.model.queue.QueueTaskFuture; import hudson.slaves.OfflineCause; -import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -202,6 +197,11 @@ public class StartJobWorker extends AbstractGearmanFunction { Queue.Executable exec = future.getStartCondition().get(); AbstractBuild currBuild = (AbstractBuild) exec; + if (!offlineWhenComplete) { + // Unlock the monitor for this worker + availability.unlock(worker); + } + long now = new Date().getTime(); int duration = (int) (now - currBuild.getStartTimeInMillis()); int estimatedDuration = (int) currBuild.getEstimatedDuration();