Skip to content
Permalink
Browse files

[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 71fa32f717d2dc1feee65478043baa507a1a4dfc
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/main/java/org/jenkinsci/plugins/pubsub/listeners/SyncQueueListener.java
@@ -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.

0 comments on commit 71fa32f

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