Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/private/TaskProcessing/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
private IAppData $appData;
private ?array $preferences = null;
private ?array $providersById = null;
private ICache $cache;
private ICache $distributedCache;

public function __construct(
Expand All @@ -101,7 +100,6 @@
ICacheFactory $cacheFactory,
) {
$this->appData = $appDataFactory->get('core');
$this->cache = $cacheFactory->createLocal('task_processing::');
$this->distributedCache = $cacheFactory->createDistributed('task_processing::');
}

Expand Down Expand Up @@ -768,8 +766,10 @@

public function getAvailableTaskTypes(bool $showDisabled = false): array {
if ($this->availableTaskTypes === null) {
// We use local cache only because distributed cache uses JSOn stringify which would botch our ShapeDescriptor objects
$this->availableTaskTypes = $this->cache->get('available_task_types');
$cachedValue = $this->distributedCache->get('available_task_types_v2');
if ($cachedValue !== null) {
$this->availableTaskTypes = unserialize($cachedValue);
}
}
// Either we have no cache or showDisabled is turned on, which we don't want to cache, ever.
if ($this->availableTaskTypes === null || $showDisabled) {
Expand Down Expand Up @@ -812,7 +812,7 @@
}

$this->availableTaskTypes = $availableTaskTypes;
$this->cache->set('available_task_types', $this->availableTaskTypes, 60);
$this->distributedCache->set('available_task_types_v2', serialize($this->availableTaskTypes), 60);
}


Expand Down Expand Up @@ -999,7 +999,7 @@
$task->setEndedAt(time());
$error = 'The task was processed successfully but the provider\'s output doesn\'t pass validation against the task type\'s outputShape spec and/or the provider\'s own optionalOutputShape spec';
$task->setErrorMessage($error);
$this->logger->error($error . ' Output was: ' . var_export($result, true), ['exception' => $e]);

Check failure on line 1002 in lib/private/TaskProcessing/Manager.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

lib/private/TaskProcessing/Manager.php:1002:64: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)
} catch (NotPermittedException $e) {
$task->setProgress(1);
$task->setStatus(Task::STATUS_FAILED);
Expand Down
Loading