fastapi as an ASGI server works best if the endpoints solely rely on async functions when interacting with external resources (database, web servers, files).
A quick search for "file" revealed a few spots where synchronous calls are used. The following list of functions should help to quickly identify those spots:
file_digest
stat
copy
unlink
mkdir
Note 1: there could be other synchronous calls in our code. Not a big problem if a few are missed as fastapi uses thread pool to execute those
Note 2: endpoints should all be async so that they can be executed in parallel. This is currently ok - unless for those that do pure "computing" and don't use external resources.
fastapi as an ASGI server works best if the endpoints solely rely on async functions when interacting with external resources (database, web servers, files).
A quick search for "file" revealed a few spots where synchronous calls are used. The following list of functions should help to quickly identify those spots:
file_digest
stat
copy
unlink
mkdir
Note 1: there could be other synchronous calls in our code. Not a big problem if a few are missed as fastapi uses thread pool to execute those Note 2: endpoints should all be async so that they can be executed in parallel. This is currently ok - unless for those that do pure "computing" and don't use external resources.
Detailled technical information in first answer to this StackOverflow question.