This commit is contained in:
2020-09-11 14:50:29 +08:00
parent 9433d631a9
commit d62b2b8228
+4 -2
View File
@@ -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);
}