e
This commit is contained in:
+4
-2
@@ -66,7 +66,7 @@ class Queue extends \Snowflake\Process\Process
|
|||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
Coroutine::sleep(0.05);
|
Coroutine::sleep(0.05);
|
||||||
} else {
|
} else {
|
||||||
$this->scheduler($data);
|
Coroutine::create([$this, 'scheduler'], $data);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
$this->application->error($exception->getMessage());
|
$this->application->error($exception->getMessage());
|
||||||
@@ -98,11 +98,13 @@ class Queue extends \Snowflake\Process\Process
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function scheduler($data)
|
private function scheduler(array $data)
|
||||||
{
|
{
|
||||||
|
$redis = Snowflake::app()->getRedis();
|
||||||
foreach ($data as $datum) {
|
foreach ($data as $datum) {
|
||||||
$this->runner($datum);
|
$this->runner($datum);
|
||||||
}
|
}
|
||||||
|
$redis->release();
|
||||||
if ($this->shutdown === true) {
|
if ($this->shutdown === true) {
|
||||||
Snowflake::shutdown($this);
|
Snowflake::shutdown($this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user