Skip to content

Commit

Permalink
Fix infinity loop on transaction committed
Browse files Browse the repository at this point in the history
  • Loading branch information
midas104 authored Jun 8, 2021
1 parent 71a99f1 commit 68ffc3d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Illuminate/Database/DatabaseTransactionsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,12 @@ public function rollback($connection, $level)
*/
public function commit($connection)
{
$this->transactions = $this->transactions->reject(function ($transaction) use ($connection) {
if ($transaction->connection == $connection) {
$transaction->executeCallbacks();
[$passes, $fails] = $this->transactions->partition(function ($transaction) use ($connection) {
return $transaction->connection == $connection;
});

return true;
}

return false;
})->values();
$this->transactions = $fails->values();
$passes->map->executeCallbacks();
}

/**
Expand Down

0 comments on commit 68ffc3d

Please sign in to comment.