From d62b2b8228ed34a852f48e3ea580779a43524421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 11 Sep 2020 14:50:29 +0800 Subject: [PATCH] e --- Queue/Queue.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Queue/Queue.php b/Queue/Queue.php index 1ec5bbc3..e3a91e95 100644 --- a/Queue/Queue.php +++ b/Queue/Queue.php @@ -66,7 +66,7 @@ class Queue extends \Snowflake\Process\Process if (empty($data)) { Coroutine::sleep(0.05); } else { - $this->scheduler($data); + Coroutine::create([$this, 'scheduler'], $data); } } catch (\Throwable $exception) { $this->application->error($exception->getMessage()); @@ -98,11 +98,13 @@ class Queue extends \Snowflake\Process\Process * @param array $data * @throws Exception */ - private function scheduler($data) + private function scheduler(array $data) { + $redis = Snowflake::app()->getRedis(); foreach ($data as $datum) { $this->runner($datum); } + $redis->release(); if ($this->shutdown === true) { Snowflake::shutdown($this); }