This commit is contained in:
2021-02-20 15:32:58 +08:00
parent 50a96b5a5f
commit a24b134d20
+4 -2
View File
@@ -30,6 +30,8 @@ class Kafka extends \Snowflake\Process\Process
protected Channel $channel; protected Channel $channel;
private int $maxLength = 5000;
/** /**
* @param Process $process * @param Process $process
@@ -103,10 +105,10 @@ class Kafka extends \Snowflake\Process\Process
*/ */
public function channelListener() public function channelListener()
{ {
$this->channel = new Channel(100); $this->channel = new Channel($this->maxLength);
Coroutine::create(function () { Coroutine::create(function () {
$group = new WaitGroup(); $group = new WaitGroup();
for ($i = 0; $i < 100; $i++) { for ($i = 0; $i < $this->maxLength; $i++) {
$group->add(); $group->add();
go(function () use ($group) { go(function () use ($group) {
defer(function () use ($group) { defer(function () use ($group) {