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

[5.1] Decrement transaction count when beginTransaction errors #13551

Merged
merged 3 commits into from
May 14, 2016

Conversation

k-k
Copy link
Contributor

@k-k k-k commented May 13, 2016

Currently the transactions count is incremented before attempting the beginTransaction call to PDO. However, its never decremented when it fails. This is fine in most cases as the exception would bubbe up.

However, when using the Job Worker Daemon, this exception is reported - but swallowed in order to keep the daemon running. That means subsequent attempts to use the Connection class from that worker cause Can't swap PDO instance while within transaction. exceptions to be thrown.

I added a couple test cases that shows that this fixes the specific issue that lead to this PR - as well as making sure existing functionality is maintained when the call succeeds.

@GrahamCampbell GrahamCampbell changed the title Decrement transaction count when beginTransaction errors [5.1] Decrement transaction count when beginTransaction errors May 13, 2016
@taylorotwell taylorotwell merged commit c8fbb8e into laravel:5.1 May 14, 2016
@k-k
Copy link
Contributor Author

k-k commented May 16, 2016

thanks @taylorotwell - any chance we can get a new tag on the 5.1 branch?

@k-k k-k deleted the begin-transaction-fix branch May 16, 2016 18:19
@k-k k-k mentioned this pull request May 19, 2016
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

Successfully merging this pull request may close these issues.

3 participants