setInterval(60 * 60 * 24); // can be deferred to maintenance window $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->appData = $appDataFactory->get('core'); } /** * @inheritDoc */ protected function run($argument): void { try { iterator_to_array($this->taskProcessingManager->cleanupTaskProcessingTaskFiles()); } catch (\Exception $e) { $this->logger->warning('Failed to delete stale task processing tasks files', ['exception' => $e]); } try { $this->taskMapper->deleteOlderThan(Manager::MAX_TASK_AGE_SECONDS); } catch (\OCP\DB\Exception $e) { $this->logger->warning('Failed to delete stale task processing tasks', ['exception' => $e]); } try { iterator_to_array($this->taskProcessingManager->clearFilesOlderThan($this->appData->getFolder('text2image'))); } catch (\OCP\Files\NotFoundException $e) { // noop } try { iterator_to_array($this->taskProcessingManager->clearFilesOlderThan($this->appData->getFolder('audio2text'))); } catch (\OCP\Files\NotFoundException $e) { // noop } } }