setInterval(60 * 60 * 24); $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); } #[\Override] protected function run($argument): void { $accountId = $argument['accountId']; if (!$this->contentManager->isContextChatAvailable()) { return; } 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 (!$this->contextChatSettingsService->isIndexingEnabled($account->getUserId())) { $this->logger->debug("indexing is turned off for account $accountId"); return; } try { $mailboxes = $this->mailManager->getMailboxes($account); } catch (ServiceException $e) { $this->logger->debug('Could not find mailboxes for account <' . $accountId . '>'); return; } foreach ($mailboxes as $mailbox) { try { $this->taskService->findByMailboxId($mailbox->getId()); $this->taskService->updateOrCreate($mailbox->getId(), 0); } catch (DoesNotExistException|MultipleObjectsReturnedException|Exception $e) { $this->logger->warning('Could not schedule context chat indexing tasks for mailbox <' . $mailbox->getId() . '>'); } } } }