-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we use async await #342
Comments
This repo uses fastapi. Might be what you're looking for. |
async/await can actually be a really nice way to separate out code with side-effects from your domain model, which should be side-effect free. in terms of the patterns in the book, it would tend to mean that anything involving a repostiory, and anything involving the UoW, becomes async. that's unfortunate because, if you want to test everything at the service layer, all your tests become async tests, which are a bit slow. so either you accept that as a cost/compromise, or you do more non-async/unit testing at the lower/domain layer. or maybe there's a clever way to avoid async in the service layer / repository / uow! that last is an open question, for me. another way of thinking about it is that async can make it really visible, in code, as to how well you're doing with the "functional core imperative shell" pattern. so i think it can be really good! |
Blocking calls to external resources create an overhead where the thread is blocked from serving other requests, async/await can lead to performance improvements in these scenarios. It allows for non-blocking I/O operations, which is particularly beneficial in web servers and applications dealing with high I/O workloads. |
Amazing work, Can we use async await with this for external calls e.g the database? If not why not, if we can what are the reasons for not adding this? Thank you!!!
The text was updated successfully, but these errors were encountered: