MerginMaps / work-packages

Mergin Maps Work Packages: manage field surveys for multiple teams
MIT License
7 stars 4 forks source link

Clean the temp_dir on unsuccessful runs of wp_mergin.py #37

Open chris9404 opened 2 years ago

chris9404 commented 2 years ago

The second to last line of code in wp_mergin.py (shutil.rmtree()) only executes if the scripts has run perfectly. In cases where there have been a crash for whatever reason, the temp_dir doesn't get cleaned.

Having all the code in a try-except, with shutil.rmtree in the finally block could solve this, I think.

Our implementation of mergin-work-packages is that it runs within a Python-daemon indefinitely (when there are crashes, it just restarts), so if the temp_dirs don't get cleaned on unsuccessful runs, our server runs out of space.