How to save large files using BackgroundTasks or equivalent? #11817
Unanswered
ArturFortunato
asked this question in
Questions
Replies: 2 comments 1 reply
-
Can confirm that downgrading to 0.105.0 fixed the issue |
Beta Was this translation helpful? Give feedback.
1 reply
-
I don't think it makes sense what you seem to be trying to do. As long as data is coming in, you would want to stay in the path operation context, as that is where the data is coming in. You could however read the input data in chunks and write the chunks to save your precious memory. At least I suspect that is what you're trying to achieve? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
My endpoints receives a very large video (2h with 1080p resolution). My function
ProjectService.upload_video
saves that video into a file. If I try to moveProjectService.upload_video(video)
tobackgroud_tasks
, I getI found a similar request here, but there was no explicit answer on how to actually use BackgroundTasks for this.
So questions are:
Thanks!
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.109.2
Pydantic Version
1.10.2
Python Version
3.9.6
Additional Context
No response
Edit: related thread here, possibly related to a breaking change release on 0.106.0
Beta Was this translation helpful? Give feedback.
All reactions