From eeb504d9a294d39bd0b0e5b34bcad56d647d69e8 Mon Sep 17 00:00:00 2001 From: Oleksii Prudkyi Date: Fri, 17 Nov 2023 04:56:17 +0200 Subject: [PATCH] fix: explicitly stage/clear transaction to correctly run afterCommit jobs (#144) laravel v10.32.0 requires explicit staging of transactions https://github.com/laravel/framework/pull/48859 # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 5 +++++ composer.json | 2 +- src/Concerns/ManagesTransactions.php | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec94064e..8f7b158d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v5.3.0 [Not released Yet] + +Fixed +- Explicitly stage/clear transaction on commit to correctly run afterCommit jobs in Laravel >= [v10.32.0](https://github.com/laravel/framework/pull/48859) (#144) + # v5.2.2 (2023-08-22) Fixed diff --git a/composer.json b/composer.json index b8b62ee1..d1c4bb56 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "php": "^8.1", "ext-grpc": "*", "ext-json": "*", - "laravel/framework": "~10.0", + "laravel/framework": "^10.32.0", "google/cloud-spanner": "^1.58.4", "grpc/grpc": "^1.42", "symfony/cache": "~6", diff --git a/src/Concerns/ManagesTransactions.php b/src/Concerns/ManagesTransactions.php index 658d9c62..29d9440b 100644 --- a/src/Concerns/ManagesTransactions.php +++ b/src/Concerns/ManagesTransactions.php @@ -141,6 +141,8 @@ protected function performSpannerCommit(): void $this->currentTransaction->commit(); } + $this->transactionsManager?->stageTransactions($this->getName()); + $this->transactions = max(0, $this->transactions - 1); if ($this->isTransactionFinished()) { $this->currentTransaction = null;