diff --git a/src/cron-center/src/CrontabDispatcherProcess.php b/src/cron-center/src/CrontabDispatcherProcess.php index a33266b..ebfac67 100644 --- a/src/cron-center/src/CrontabDispatcherProcess.php +++ b/src/cron-center/src/CrontabDispatcherProcess.php @@ -1,6 +1,7 @@ strategy = $container->get(StrategyInterface::class); $this->parser = make(Parser::class); $this->cron_manager = make(CronManager::class); + $this->config = $container->get(ConfigInterface::class); + } + + public function isEnable($server): bool + { + return $this->config->get('cron_center.enable', false); } public function handle(): void { - if (!config('cron_center.enable', false)) { - return; - } $this->event->dispatch(new CrontabDispatcherStarted()); while (true) { $this->cron_manager->createOrUpdateNode();