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
This commit is contained in:
parent
46155d86a3
commit
1226ef8d57
@ -64,13 +64,16 @@ class MultiQueue(object):
|
|||||||
return count
|
return count
|
||||||
|
|
||||||
def put(self, item, priority):
|
def put(self, item, priority):
|
||||||
|
added = False
|
||||||
self.condition.acquire()
|
self.condition.acquire()
|
||||||
try:
|
try:
|
||||||
if item not in self.queues[priority]:
|
if item not in self.queues[priority]:
|
||||||
self.queues[priority].append(item)
|
self.queues[priority].append(item)
|
||||||
|
added = True
|
||||||
self.condition.notify()
|
self.condition.notify()
|
||||||
finally:
|
finally:
|
||||||
self.condition.release()
|
self.condition.release()
|
||||||
|
return added
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
self.condition.acquire()
|
self.condition.acquire()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user