From 7b543d68190a2eff22f856ef49aab7dfda336a27 Mon Sep 17 00:00:00 2001 From: David Badura Date: Sun, 3 Mar 2024 11:19:28 +0100 Subject: [PATCH] improve batch processing in projectionist --- src/Projection/Projectionist/DefaultProjectionist.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Projection/Projectionist/DefaultProjectionist.php b/src/Projection/Projectionist/DefaultProjectionist.php index 850539c1b..b233d26d1 100644 --- a/src/Projection/Projectionist/DefaultProjectionist.php +++ b/src/Projection/Projectionist/DefaultProjectionist.php @@ -141,6 +141,10 @@ function ($projections) use ($limit): void { } } } finally { + foreach ($projections as $projection) { + $this->projectionStore->update($projection); + } + $stream?->close(); } @@ -263,6 +267,10 @@ function (array $projections) use ($limit): void { } } } finally { + foreach ($projections as $projection) { + $this->projectionStore->update($projection); + } + $stream?->close(); } @@ -547,7 +555,6 @@ private function handleMessage(int $index, Message $message, Projection $project if ($subscribeMethods === []) { $projection->changePosition($index); - $this->projectionStore->update($projection); $this->logger?->debug( sprintf( @@ -583,7 +590,6 @@ private function handleMessage(int $index, Message $message, Projection $project $projection->changePosition($index); $projection->resetRetry(); - $this->projectionStore->update($projection); $this->logger?->debug( sprintf(