Improve removed tasks handing in DelayedTaskQueue.pop_ready

This commit is contained in:
Dana Powers
2015-12-30 12:18:02 -08:00
parent cfae9e3fa3
commit 61161d8335

View File

@@ -465,8 +465,11 @@ class DelayedTaskQueue(object):
def pop_ready(self):
"""Pop and return a list of all ready (task, future) tuples"""
self._drop_removed()
ready_tasks = []
while self._tasks and self._tasks[0][0] < time.time():
ready_tasks.append(self._pop_next())
try:
task = self._pop_next()
except KeyError:
break
ready_tasks.append(task)
return ready_tasks