From 679b323a5e97185a7c8d0234e3f8a92108808658 Mon Sep 17 00:00:00 2001 From: titrxw <1120309488@qq.com> Date: Fri, 11 Jun 2021 15:26:19 +0800 Subject: [PATCH] =?UTF-8?q?delete:=20=E5=88=A0=E9=99=A4container=20singlet?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Listener/AfterPipeMessageListener.php | 2 +- src/Listener/AfterWorkerStartListener.php | 4 ++-- src/ServiceProvider.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Listener/AfterPipeMessageListener.php b/src/Listener/AfterPipeMessageListener.php index b0dc53b..fab68dc 100644 --- a/src/Listener/AfterPipeMessageListener.php +++ b/src/Listener/AfterPipeMessageListener.php @@ -39,7 +39,7 @@ public function run(...$params) { } catch (\Throwable $throwable) { $message->result = $throwable->getMessage(); $this->getEventDispatcher()->dispatch(new AfterCronTaskExecutorEvent($message, $throwable)); - $this->getContainer()->singleton(HandlerExceptions::class)->getHandler()->report($throwable); + $this->getContainer()->get(HandlerExceptions::class)->getHandler()->report($throwable); } } } diff --git a/src/Listener/AfterWorkerStartListener.php b/src/Listener/AfterWorkerStartListener.php index 3a80549..fdaa659 100644 --- a/src/Listener/AfterWorkerStartListener.php +++ b/src/Listener/AfterWorkerStartListener.php @@ -26,10 +26,10 @@ public function run(...$params) { \isetProcessTitle(App::$server->getPname() . 'crontab dispatcher process'); if ((ENV & DEBUG) === DEBUG) { - $this->getContainer()->singleton(Output::class)->info('Crontab run at ' . date('Y-m-d H:i:s')); + $this->getContainer()->get(Output::class)->info('Crontab run at ' . date('Y-m-d H:i:s')); } - $this->getContainer()->singleton('cron-task-scheduler')->schedule(); + $this->getContainer()->get('cron-task-scheduler')->schedule(); } elseif ($workerId > Server::getDispatcherWorkerId() && $workerId <= Server::getMaxExecuteWorkerId()) { \isetProcessTitle(App::$server->getPname() . 'crontab execute process'); } diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 0bb357b..18506bf 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -68,7 +68,7 @@ private function registerScheduler() { * @var SchedulerAbstract $scheduler */ $scheduler = $this->config->get('crontab.setting.scheduler', LoopScheduler::class); - $scheduler = new $scheduler($this->container->singleton('cron-task-manager'), $this->container->singleton('cron-task-strategy')); + $scheduler = new $scheduler($this->container->get('cron-task-manager'), $this->container->get('cron-task-strategy')); $scheduler->setEventDispatcher($this->getEventDispatcher()); return $scheduler;