Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-41832] Fix spinning in SyncQueueListener (#6)
Fixes spinning at 100% when none of the tasks are done.
  • Loading branch information
szym authored and tfennelly committed Feb 8, 2017
1 parent c219cbe commit 71fa32f
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -94,15 +94,15 @@ public void run() {
if (leftItem != null) {
QueueTaskFuture<Queue.Executable> future = leftItem.getFuture();

// Drain the "try later" queue now before we possibly add more to
// it (see below). If the main queue (queueTaskLeftPublishQueue) was empty,
// the above poll on it would have ensured that we waited at least
// the poll timeout period before retrying ones that were not
// "done" on an earlier iteration.
// See top level comments.
tryLaterQueueTaskLeftQueue.drainTo(queueTaskLeftPublishQueue);

if (future.isDone()) {
// Drain the "try later" queue now before we possibly add more to
// it (see below). If the main queue (queueTaskLeftPublishQueue) was empty,
// the above poll on it would have ensured that we waited at least
// the poll timeout period before retrying ones that were not
// "done" on an earlier iteration.
// See top level comments.
tryLaterQueueTaskLeftQueue.drainTo(queueTaskLeftPublishQueue);

publish(leftItem, Events.JobChannel.job_run_queue_task_complete, null);
} else {
// Not done. Put the item back on the queue and test again later.
Expand Down

0 comments on commit 71fa32f

Please sign in to comment.