From 352664ee95ef524c9b1e39e179e76aba0cfffce9 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 14 Jun 2013 17:28:08 -0700 Subject: [PATCH] Send final packet immediately. Rather than waiting for it to be sent on the next pass through the loop. Change-Id: If77bf1e0be6946d6a0b5db33cec5d1caf98cd058 --- .../hudson/plugins/gearman/MyGearmanWorkerImpl.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java b/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java index 0e85695..85602d0 100644 --- a/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java +++ b/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java @@ -574,6 +574,16 @@ public class MyGearmanWorkerImpl implements GearmanSessionEventHandler { // make it as far as the schedule job unlock. availability.unlock(this); } + + // We should have submitted either a WORK_EXCEPTION, COMPLETE, + // or FAIL; make sure it gets sent. + try { + session.driveSessionIO(); + } catch (IOException ioe) { + LOG.warn("Received IOException while driving" + + " IO on session " + session, ioe); + session.closeSession(); + } } private GearmanPacketType getGrabJobPacketType() {