Skip to content

Commit

Permalink
delete: 删除container singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
titrxw committed Jun 11, 2021
1 parent 4f5771d commit 679b323
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Listener/AfterPipeMessageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Listener/AfterWorkerStartListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 679b323

Please sign in to comment.