Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Console/Command/WorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand Down
3 changes: 2 additions & 1 deletion src/Parallel/Application/ParallelFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions src/Parallel/Enum/StreamFormat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Rector\Parallel\Enum;

final class StreamFormat
{
public const int DEPTH = 512;

public const int MAX_LENGTH = 4 * 1024 * 1024;
}
Loading