Skip to content

Commit

Permalink
Merge pull request #417 from aiven/alex-fix-multiprocess-pool-exit
Browse files Browse the repository at this point in the history
Properly handle fetcher pool when exiting

#417
  • Loading branch information
rikonen authored Mar 18, 2021
2 parents cb0962f + 6b3beca commit 95b8393
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 95b8393

Please sign in to comment.