Skip to content
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

Concurrent throwing can cause statements to be executed after ROLLBACK #3

Open
hvrauhal opened this issue Aug 21, 2015 · 2 comments
Open

Comments

@hvrauhal
Copy link
Member

return using(pgrm.getTransaction(), function (tx) {
  return Promise.props({
    dbStuffThatShouldBeRollbacked: tx.queryAsync('delete from user'),
    otherThingThatJustCrashes: Promise.reject(new Error("just fail"))
  })
})

can cause the following commands in the SQL connection:

BEGIN
ROLLBACK
delete from user
@pnex2000
Copy link
Contributor

Wouldn't the settle method take care of this? "Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected."

https://github.com/petkaantonov/bluebird/blob/master/API.md#settle---promise

@hvrauhal
Copy link
Member Author

Here's a short gist demonstrating this issue https://gist.github.com/hvrauhal/a5580741097be44c8fc8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants