Skip to content

Conversation

cmorbitzer
Copy link
Contributor

This PR adds a check that a connection is not missing before beginning a transaction, and reconnects if it is. This is the same check added in 143f7a9 that is performed before running a query in Illuminate\Database\Connection::run().

I ran into this while running a Laravel Excel queued import on Vapor. Vapor disconnects all database connections at the end of each queued job execution in QueueHandler::terminate(). When the worker executes the next job, app('db.connection')->getPdo() returns null unless the connection is re-established, which currently only happens when running a query. So when the ReadChunk queued job in Laravel Excel attempts to begin a transaction before running a query here, $this->getPdo()->beginTransaction() in ManagesTransactions results in the error Call to a member function beginTransaction() on null.

@taylorotwell taylorotwell merged commit 742ff2d into laravel:6.x Oct 31, 2019
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.

2 participants