Skip to content

Commit

Permalink
Properly handle fetcher pool when exiting
Browse files Browse the repository at this point in the history
Context manager does not seem to properly wait for the subprocesses to exit, let's join
the pool manually (close need to be called before joining)
  • Loading branch information
alexole committed Mar 18, 2021
1 parent cb0962f commit 6b3beca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pghoard/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ def fetch_all(self):
with self.pool_class(processes=self._process_count()) as pool:
self._queue_jobs(pool)
self._wait_for_jobs_to_complete()
# Context manager does not seem to properly wait for the subprocesses to exit, let's join
# the pool manually (close need to be called before joining)
pool.close()
pool.join()
break
except TimeoutError:
self.pending_jobs.clear()
Expand Down

0 comments on commit 6b3beca

Please sign in to comment.