This commit is contained in:
2020-10-12 12:51:59 +08:00
parent 681f5f3f68
commit ffc8f5db54
+7 -2
View File
@@ -68,8 +68,13 @@ class Kafka extends \Snowflake\Process\Process
$this->channel = new Channel(1000);
Coroutine::create(function () {
$group = new WaitGroup();
while ([$topic, $part, $message] = $this->channel->pop()) {
$this->handlerExecute($group, $topic, $part, $message);
for ($i = 0; $i < 1000; $i++) {
$group->add();
go(function () use ($group) {
while ([$topic, $part, $message] = $this->channel->pop()) {
$this->handlerExecute($group, $topic, $part, $message);
}
});
}
$group->wait();
});