$tasks=$this->taskProcessingManager->getTasks(userId:'',scheduleAfter:$this->timeFactory->now()->getTimestamp()-60*60*self::TIME_SPAN);// userId: '' means no filter, whereas null would mean guest
$taskCount=count($tasks);
if($taskCount===0){
returnSetupResult::success($this->l10n->t('No scheduled tasks in the last {hours} hours.',['hours'=>self::TIME_SPAN]));
}
$slowCount=0;
foreach($tasksas$task){
if($task->getStartedAt()===null){
continue;// task was not picked up yet
}
if($task->getScheduledAt()===null){
continue;// task was not scheduled yet -- should not happen, but the API specifies null as return value
returnSetupResult::warning($this->l10n->t('The task pickup speed has been slow in the last {hours} hours. Many tasks took longer than 4 minutes to be picked up. Consider setting up a worker to process tasks in the background.',['hours'=>self::TIME_SPAN]),'https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#improve-ai-task-pickup-speed');