Skip to content

Commit

Permalink
wait for all futures before performing cleanup (fix #157)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 11, 2023
1 parent 5aa0b3c commit 085eaa1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mergin/client_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ def download_project_is_running(job):
"""
for future in job.futures:
if future.done() and future.exception() is not None:
# wait for any runinnig futures and cancel any pending futures before performing cleanup, as this may cause
# issues while performing cleanup, see https://github.com/MerginMaps/mergin-py-client/issues/157
job.is_cancelled = True
job.executor.shutdown(wait=True, cancel_futures=True)

_cleanup_failed_download(job.directory, job.mp)
raise future.exception()
if future.running():
Expand Down

0 comments on commit 085eaa1

Please sign in to comment.