dirkhh / adsb-feeder-image

Easy to use turn-key SD card image for a number of popular single board computers to run a complete ADS-B feeder
https://adsb.im/home
GNU General Public License v3.0
130 stars 14 forks source link

backup: streamed zipfile generation #134

Closed wiedehopf closed 7 months ago

wiedehopf commented 7 months ago

When clicking the download button for the backup options, the download only starts once the zipfile has been created completely. This results in delayed user feedback which is never pretty, potentially leading to multiple button clicks which will create multiple tempfiles.

Instead of creating a zipfile and writing it to a tempfile, use a pipe. A thread is started which writes the zipped data to the pipe. Flasks send_file will read the data from the pipe so the download can instantly start while the zipfile is being created.

The new approach also means that using the backup function no longer causes any sd-card wear.