Improve CPU usage

This commit is contained in:
Andras Schmelczer 2022-07-01 19:57:24 +02:00
parent dac4ce7b7c
commit 06cd7de379
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E

View file

@ -16,10 +16,10 @@ def mapper_function(
try:
while not should_stop.is_set():
try:
input_chunk = input_queue.get_nowait()
input_chunk = input_queue.get(1)
output_chunk = [(i, map_function(v)) for i, v in input_chunk]
output_queue.put(output_chunk)
except queue.Empty:
pass
except KeyboardInterrupt:
except (KeyboardInterrupt, BrokenPipeError):
return