You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Promise.all() rejects as soon as the first promise gets rejected, triggering a rollback. If other operations referencing the transaction are still pending, they get orphaned and executed outside the transaction, making it appear as if the rollback did not happen.
You need to use something like Promise.allSettled() instead, and throw if any promise failed.
I have a function that uses
@transactional()
excute() {
...
const promises = [];
promises.push(this.receiptDetailRepo.save(listReceiptDetail))
promises.push(this.lotattributeRepo.insert(listLotattribute))
promises.push(this.lotxlocxidRepo.save(listIvUpdate))
promises.push(this.lotxlocxidRepo.insert(listIvInsert))
promises.push(this.itrnRepo.insert(listItrn))
promises.push(Promise.reject("ERROR"));
const [resReceiptDetails] = await Promise.all(promises);
}
but it doesn't rollback;
What I am missing?
The text was updated successfully, but these errors were encountered: