diff --git a/mergin/client_pull.py b/mergin/client_pull.py index 0b1b5ef..defd52f 100644 --- a/mergin/client_pull.py +++ b/mergin/client_pull.py @@ -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():