Skip to content

Commit

Permalink
修复进度条跟不上任务完成的速度
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou-JiaJun committed Aug 7, 2023
1 parent 91e361f commit d33a876
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions rqalpha/utils/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,22 @@ def shutdown(self, wait=True):
if not wait:
return super(ProgressedProcessPoolExecutor, self).shutdown(wait)
progress_bar = click.progressbar(length=self._total_steps, show_eta=False)
finish = False
while True:
try:
step = self._progress_queue.get(timeout=0.5)
except queue.Empty:
pass
else:
progress_bar.update(step)

for fut in self._futures:
if fut.running():
break
else:
finish = True
while True:
try:
step = self._progress_queue.get(timeout=0.5)
except queue.Empty:
break
else:
progress_bar.update(step)

if finish:
break

progress_bar.render_finish()
Expand Down

0 comments on commit d33a876

Please sign in to comment.