UpstreamDataInc / goosebit

A simplistic, opinionated remote update server implementing hawkBit™'s DDI API.
https://goosebit.rtfd.io
Apache License 2.0
18 stars 5 forks source link

Use async methods for all file operations #124

Closed tsagadar closed 2 months ago

tsagadar commented 2 months ago

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:

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.