From ac7382da6ca3c7dea83c0ba23c86e8dda648aef8 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sat, 20 Mar 2021 04:04:42 +0800 Subject: [PATCH] modify --- System/Process/CrontabProcess.php | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/System/Process/CrontabProcess.php b/System/Process/CrontabProcess.php index 14423914..0db57b8d 100644 --- a/System/Process/CrontabProcess.php +++ b/System/Process/CrontabProcess.php @@ -30,35 +30,9 @@ class CrontabProcess extends Process * @param \Swoole\Process $process */ public function onHandler(\Swoole\Process $process): void - { - $this->channel = new Channel(1000); - Coroutine\go(function () { - $this->waitGroup(); - }); - $this->readByWorker($process); - } - - - /** - * @param $process - */ - private function readByWorker($process) - { - $this->channel->push($process->read()); - -// Coroutine::sleep(0.01); - - $this->readByWorker($process); - } - - - /** - * @throws \Exception - */ - private function waitGroup() { try { - $content = $this->channel->pop(); + $content = $process->read(); $_content = json_decode($content, true); if (is_null($_content)) { @@ -69,7 +43,7 @@ class CrontabProcess extends Process } catch (\Throwable $exception) { $this->application->error($exception->getMessage()); } finally { - $this->waitGroup(); + $this->onHandler($process); } }