accountService = $accountService; $this->classifier = $classifier; $this->jobList = $jobList; $this->logger = $logger; $this->classificationSettingsService = $classificationSettingsService; $this->setInterval(24 * 60 * 60); $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** * @return void */ #[\Override] protected function run($argument) { $accountId = (int)$argument['accountId']; try { $account = $this->accountService->findById($accountId); } catch (DoesNotExistException $e) { $this->logger->debug('Could not find account <' . $accountId . '> removing from jobs'); $this->jobList->remove(self::class, $argument); return; } if (!$account->getMailAccount()->canAuthenticateImap()) { $this->logger->debug('Cron importance classifier training not possible: no authentication on IMAP possible'); return; } if (!$this->classificationSettingsService->isClassificationEnabled($account->getUserId())) { $this->logger->debug("classification is turned off for account $accountId"); return; } try { $this->classifier->train($account, $this->logger); } catch (Throwable $e) { $this->logger->error('Cron importance classifier training failed: ' . $e->getMessage(), [ 'exception' => $e, ]); } } }