Reduce spinning while waiting on queues

This commit is contained in:
James Cammarata
2015-11-12 14:40:56 -05:00
parent e2af57062c
commit 13750f68ee
3 changed files with 3 additions and 6 deletions

View File

@@ -73,11 +73,11 @@ class ResultProcess(multiprocessing.Process):
try:
if not rslt_q.empty():
debug("worker %d has data to read" % self._cur_worker)
result = rslt_q.get()
result = rslt_q.get(block=False)
debug("got a result from worker %d: %s" % (self._cur_worker, result))
break
except queue.Empty:
pass
time.sleep(0.01)
if self._cur_worker == starting_point:
break