Improve CPU usage
This commit is contained in:
parent
b56273e267
commit
c1d32741c1
1 changed files with 2 additions and 2 deletions
|
|
@ -16,10 +16,10 @@ def mapper_function(
|
||||||
try:
|
try:
|
||||||
while not should_stop.is_set():
|
while not should_stop.is_set():
|
||||||
try:
|
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_chunk = [(i, map_function(v)) for i, v in input_chunk]
|
||||||
output_queue.put(output_chunk)
|
output_queue.put(output_chunk)
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
pass
|
pass
|
||||||
except KeyboardInterrupt:
|
except (KeyboardInterrupt, BrokenPipeError):
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue