Merge pull request #49260 from nextcloud/fix/noid/textprocessing-schedule-taskprocessing-provider

[textprocessing] Fix: Accept scheduling a task if there are equivalent taskprocessing providers only
This commit is contained in:
Julien Veyssier 2024-11-14 11:58:09 +01:00 committed by GitHub
commit 428e7a32b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -221,7 +221,11 @@ class Manager implements IManager {
}
$task->setStatus(OCPTask::STATUS_SCHEDULED);
$providers = $this->getPreferredProviders($task);
if (count($providers) === 0) {
$equivalentTaskProcessingTypeAvailable = (
isset(self::$taskProcessingCompatibleTaskTypes[$task->getType()])
&& isset($this->taskProcessingManager->getAvailableTaskTypes()[self::$taskProcessingCompatibleTaskTypes[$task->getType()]])
);
if (count($providers) === 0 && !$equivalentTaskProcessingTypeAvailable) {
throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task');
}
[$provider,] = $providers;