-
Notifications
You must be signed in to change notification settings - Fork 31
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
Transaction is not rolled back when operations are inside a Promise.all
#56
Comments
On other hand, when one uses the native typeorm transaction and wraps the transaction like
It works as expected. |
@iamtiagodev I think you should handle this on your own here. You should change Promise.all to allSettled and throw the error once all is processed and any is rejected. |
@szwalkowski apologies for not following up and... yup, you are totally correct 👍 I did a small PoC to study transactional behaviour. I'll leave it here in case someone else bumps into this thread https://github.com/iamtiagodev/typeorm-transaction-experiment |
Given two services as in the example bellow:
When on one of the calls inside
Promise.all
fails (i.e. an exception is thrown ) the rollback doesn't always behave as it should. Sometimes it does rollback, but others it only rollsback the selects for the save (upsert) operations.When
logging: true
in nestJS configs, I get the following SQL operationsDoes this mean this lib doesn't support
Promise.all
and we have to wait for each of the calls? 🤔The text was updated successfully, but these errors were encountered: