From 4bea96f74775673fb1f3febf31e6bf54a764eac5 Mon Sep 17 00:00:00 2001 From: webard Date: Sat, 12 Sep 2026 13:10:23 +0200 Subject: [PATCH 1/2] worker decoder frame limit --- src/Console/Command/WorkerCommand.php | 3 ++- src/Parallel/Application/ParallelFileProcessor.php | 3 ++- src/Parallel/Enum/StreamFormat.php | 13 +++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/Parallel/Enum/StreamFormat.php diff --git a/src/Console/Command/WorkerCommand.php b/src/Console/Command/WorkerCommand.php index 2fe40cc6cc4..8b7d4c1061c 100644 --- a/src/Console/Command/WorkerCommand.php +++ b/src/Console/Command/WorkerCommand.php @@ -18,6 +18,7 @@ use Rector\Parallel\Enum\Action; use Rector\Parallel\Enum\ReactCommand; use Rector\Parallel\Enum\ReactEvent; +use Rector\Parallel\Enum\StreamFormat; use Rector\Parallel\ValueObject\Bridge; use Rector\StaticReflection\DynamicSourceLocatorDecorator; use Rector\Util\MemoryLimiter; @@ -79,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $input, $output ): void { - $inDecoder = new Decoder($connection, true, 512, JSON_INVALID_UTF8_IGNORE); + $inDecoder = new Decoder($connection, true, StreamFormat::DEPTH, JSON_INVALID_UTF8_IGNORE, StreamFormat::MAX_LENGTH); $outEncoder = new Encoder($connection, JSON_INVALID_UTF8_IGNORE); $outEncoder->write([ diff --git a/src/Parallel/Application/ParallelFileProcessor.php b/src/Parallel/Application/ParallelFileProcessor.php index e0331571938..88f596b27f3 100644 --- a/src/Parallel/Application/ParallelFileProcessor.php +++ b/src/Parallel/Application/ParallelFileProcessor.php @@ -18,6 +18,7 @@ use Rector\Parallel\Enum\Content; use Rector\Parallel\Enum\ReactCommand; use Rector\Parallel\Enum\ReactEvent; +use Rector\Parallel\Enum\StreamFormat; use Rector\Parallel\ValueObject\Bridge; use Rector\Parallel\ValueObject\ParallelProcess; use Rector\Parallel\ValueObject\ProcessPool; @@ -82,7 +83,7 @@ public function process( $this->processPool = new ProcessPool($tcpServer); $tcpServer->on(ReactEvent::CONNECTION, function (ConnectionInterface $connection) use (&$jobs): void { - $inDecoder = new Decoder($connection, true, 512, 0, 4 * 1024 * 1024); + $inDecoder = new Decoder($connection, true, StreamFormat::DEPTH, 0, StreamFormat::MAX_LENGTH); $outEncoder = new Encoder($connection); $inDecoder->on(ReactEvent::DATA, function (array $data) use (&$jobs, $inDecoder, $outEncoder): void { diff --git a/src/Parallel/Enum/StreamFormat.php b/src/Parallel/Enum/StreamFormat.php new file mode 100644 index 00000000000..1179fe650d7 --- /dev/null +++ b/src/Parallel/Enum/StreamFormat.php @@ -0,0 +1,13 @@ + Date: Sat, 12 Sep 2026 13:12:51 +0200 Subject: [PATCH 2/2] fix new line --- src/Parallel/Enum/StreamFormat.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Parallel/Enum/StreamFormat.php b/src/Parallel/Enum/StreamFormat.php index 1179fe650d7..f598d73e2ed 100644 --- a/src/Parallel/Enum/StreamFormat.php +++ b/src/Parallel/Enum/StreamFormat.php @@ -4,7 +4,6 @@ namespace Rector\Parallel\Enum; - final class StreamFormat { public const int DEPTH = 512;