Conversation
|
Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration ( |
dc96865 to
1facaed
Compare
|
another way for not jump 100x times into a thread is to use deque from functiontools which is none blocking, and write each junk into queue and write it inside the thread. So there would be only 1 context switch |
The point of a streaming file upload is to not write the whole content to RAM first. Yes, we could do this but it will increase the RAM usage for larger files and then we might as well just revert the whole streaming approach. |
|
Correct, with Janus you stream it into the thread, so you don't have a context switch and waiting for a thread after each junk. You can also limit the buffer and it get wait on the async part until the thread processed the buffer |
0c3e795 to
669b8e2
Compare
|
@marvin-w you can still achieve that with janus by calling https://github.com/aio-libs/janus/blob/master/janus/__init__.py#L602 |
2138171 to
3f139e5
Compare
I gave it a shot, it is working. However, I'm not 100% sure if it is correct like that. Especially the future handling looks kind of dirty. Open for suggestions :). |
Proposed change
As spoken with balloob this PR will increase the file upload limit via the new file upload API from 10 MB to 100 MB. It now also uses streaming to upload and reads the data in 1 MB chunks (if available) and writes them to the file.
Things that we should check as well:
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: