From 07f1d8e650aea83f28b0a28632c82cd3f7c36004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 28 Oct 2020 16:49:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kafka/Producer.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Kafka/Producer.php b/Kafka/Producer.php index c8c34e21..4808327d 100644 --- a/Kafka/Producer.php +++ b/Kafka/Producer.php @@ -104,7 +104,6 @@ class Producer extends Component if ($rk->getOutQLen() > 0) { $this->clean($rk, $timeout); } - $topic = $rk->newTopic($this->_topic, $this->topicConf); $topic->produce(RD_KAFKA_PARTITION_UA, 0, $message, $key); $this->clean($rk, $timeout); @@ -117,7 +116,9 @@ class Producer extends Component */ private function clean($rk, $timeout) { - $rk->poll(0); + for ($length = 0; $length < $rk->getOutQLen(); $length++) { + $rk->poll(0); + } $rk->flush($timeout); }