django-downloadview
django-downloadview copied to clipboard
Add Async Support
Currently, the DownloadView operates as a sync view. It's very possible (and much more efficient) to do everything async.
File reading will have to be done via aiofile
in order to not break the ASGI event queue though. After this change, Django versions will need to be limited to 3.1+
Would you be interested to file a PR implementing this?
Yes, but my time is spread a bit thin across the projects I currently support. It might take a while for me to get to this.
Note: I have an in-progress PR for whitenoise
which has an implementation of sending files via async in Django. The implementation in this repo would be heavily similar.
I believe Django supports async iterators within StreamingHttpResponse
now. Async support within django-downloadview
should be pretty simple to implement especially since I created a Django-compatible async file iterator in that whitenoise
PR.