From 1226ef8d57379c1cd0330487c5da038f8ee24233 Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jeblair@hp.com>
Date: Thu, 4 Jun 2015 09:20:40 -0700
Subject: [PATCH] Fix waiting for tasks

The change to avoid duplicate tasks in a queue had an error where
it would cause all tasks to be immediately marked as completed.
This caused the synchronous task waits on actions such as immediate
sync of a single change to return early, before actual completion.

This may have caused other errors as well.

Change-Id: Ie000a1242db17b1bed8c2eac919e242225f5bba6
---
 gertty/sync.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gertty/sync.py b/gertty/sync.py
index 7f26c1a..1735cd2 100644
--- a/gertty/sync.py
+++ b/gertty/sync.py
@@ -64,13 +64,16 @@ class MultiQueue(object):
         return count
 
     def put(self, item, priority):
+        added = False
         self.condition.acquire()
         try:
             if item not in self.queues[priority]:
                 self.queues[priority].append(item)
+                added = True
             self.condition.notify()
         finally:
             self.condition.release()
+        return added
 
     def get(self):
         self.condition.acquire()