Speed up packing

The .get() function raises a queue.Empty exception anyway, so there was
no real need for the .empty() call. Furthermore, it turned out to really
slow things down.
This commit is contained in:
Sybren A. Stüvel 2018-06-05 14:47:24 +02:00
parent 7e4fa34aae
commit 44c4ce3a69

View File

@ -130,7 +130,7 @@ class ThreadSafeCallback(Callback):
def flush(self, timeout: float = None) -> None:
"""Call the queued calls, call this in the main thread."""
while not self._reporting_queue.empty():
while True:
try:
call = self._reporting_queue.get(block=timeout is not None,
timeout=timeout)