Skip to content

Commit

Permalink
Wait for validation Pool to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
replaceafill authored and sevein committed Aug 30, 2024
1 parent 5b77243 commit 902051d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions bagit.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,12 @@ def _validate_entries(self, processes):
if processes == 1:
hash_results = [_calc_hashes(i) for i in args]
else:
try:
pool = multiprocessing.Pool(
processes if processes else None, initializer=worker_init
)
hash_results = pool.map(_calc_hashes, args)
finally:
pool.terminate()
pool = multiprocessing.Pool(
processes if processes else None, initializer=worker_init
)
hash_results = pool.map(_calc_hashes, args)
pool.close()
pool.join()

# Any unhandled exceptions are probably fatal
except:
Expand Down

0 comments on commit 902051d

Please sign in to comment.