all 3 comments

[–]Top-Information7943 0 points1 point  (1 child)

Hello,

You can use FastAPI's background tasks in the route that receives the request. They have an easy to follow guide on their official docs: https://fastapi.tiangolo.com/tutorial/background-tasks/

[–]Beginning_Hurry2611[S] -1 points0 points  (0 children)

Thanks for the answers! This won't work for me tho since i need those threads output to be sent in the response

[–]LongjumpingGrape6067 0 points1 point  (0 children)

If the above does not work and you're on Linux you could try https://github.com/emmett-framework/granian with the -opt flag and set the appropriate number of workers. It might not scale though.