From 4066226e45af30dd8a54493be746a14dae53e784 Mon Sep 17 00:00:00 2001 From: xinyangbest Date: Fri, 27 Jul 2018 18:31:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Process/Worker.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Process/Worker.php b/src/Process/Worker.php index dc8c59c..f2248a8 100755 --- a/src/Process/Worker.php +++ b/src/Process/Worker.php @@ -76,11 +76,15 @@ public function run() try { if ($this->blocking) { $data = Container::instance()->delayqueue->bpop($this->topics,$this->interval); - Container::instance()->logger->info(sprintf('blocking with timeout of %d',$this->interval)); + if(empty($data)){ + Container::instance()->logger->info(sprintf('blocking with timeout of %d',$this->interval)); + } } else { $data = Container::instance()->delayqueue->pop($this->topics); - sleep($this->interval); - Container::instance()->logger->info(sprintf('sleeping with timeout of %d',$this->interval)); + if(empty($data)){ + sleep($this->interval); + Container::instance()->logger->info(sprintf('sleeping with timeout of %d',$this->interval)); + } } } catch (\Exception $exception) {