modify plugin name

This commit is contained in:
2022-03-03 18:30:59 +08:00
parent 9cd44aad3d
commit 4af173deff
5 changed files with 38 additions and 67 deletions
+9 -4
View File
@@ -2,10 +2,12 @@
namespace Kiri\Task;
use Exception;
use JetBrains\PhpStorm\Pure;
use Kiri\Abstracts\Component;
use Kiri\Core\HashMap;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Swoole\Server;
@@ -17,10 +19,13 @@ class TaskManager extends Component
/**
*
* @param ContainerInterface $container
* @param array $config
* @throws Exception
*/
public function init()
public function __construct(public ContainerInterface $container, array $config = [])
{
parent::__construct($config);
$this->hashMap = new HashMap();
}
@@ -38,7 +43,7 @@ class TaskManager extends Component
}
$task_use_object = $swollen->setting['task_object'] ?? $swollen->setting['task_use_object'] ?? false;
$reflect = $this->getContainer()->get(OnServerTask::class);
$reflect = $this->container->get(OnServerTask::class);
$swollen->on('finish', [$reflect, 'onFinish']);
if ($task_use_object || $swollen->setting['task_enable_coroutine']) {
@@ -79,7 +84,7 @@ class TaskManager extends Component
{
$task = $this->hashMap->get($key);
if (is_string($task)) {
$task = $this->getContainer()->get($task);
$task = $this->container->get($task);
if (!empty($task)) {
$this->add($key, $task);
}