From 6fda19d2bc653a8758609feb7d5de00d8da42ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Wed, 28 Oct 2020 16:30:01 +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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Kafka/Producer.php b/Kafka/Producer.php index abe28cc7..162fe933 100644 --- a/Kafka/Producer.php +++ b/Kafka/Producer.php @@ -108,18 +108,20 @@ class Producer extends Component $rk->poll($timeout); $event = Snowflake::app()->getEvent(); - $event->on(Event::EVENT_AFTER_REQUEST, [$this, 'onFlush'], [$rk, $timeout]); + $event->on(Event::EVENT_AFTER_REQUEST, [$this, 'onFlush']); } /** - * @param $rk - * @param $timeout + * @throws NotFindClassException + * @throws ReflectionException */ - public function onFlush($rk, $timeout) + public function onFlush() { - var_dump(func_get_args()); + /** @var \RdKafka\Producer $rk */ + $rk = Snowflake::getDi()->get(\RdKafka\Producer::class); + $this->debug(Event::EVENT_AFTER_REQUEST); - $rk->flush($timeout); + $rk->flush(10); } }