Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/Symfony/Component/Messenger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CHANGELOG
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport` and
`Symfony\Component\Messenger\Transport\InMemory\InMemoryTransportFactory`
* Allow passing a string instead of an array in `TransportNamesStamp`
* Allow to define batch size when using `BatchHandlerTrait` with `getBatchSize()`

6.2
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private function handle(object $message, ?Acknowledger $ack): mixed

private function shouldFlush(): bool
{
return 10 <= \count($this->jobs);
return $this->getBatchSize() <= \count($this->jobs);
}

/**
Expand All @@ -64,4 +64,9 @@ private function shouldFlush(): bool
* @list<array{0: object, 1: Acknowledger}> $jobs A list of pairs of messages and their corresponding acknowledgers
*/
abstract private function process(array $jobs): void;

private function getBatchSize(): int
{
return 10;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ public function __invoke(DummyMessage $message, Acknowledger $ack = null)
return $this->handle($message, $ack);
}

private function shouldFlush()
private function getBatchSize(): int
{
return 2 <= \count($this->jobs);
return 2;
}

private function process(array $jobs): void
Expand Down