diff options
author | Marcel Klehr <mklehr@gmx.net> | 2025-02-04 12:40:37 +0100 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2025-02-04 12:54:13 +0100 |
commit | 49a52126abe2ebca4f616fe6a2a125183305c88a (patch) | |
tree | 63538e71a31e299eb4e16dc01454e64804153dcf | |
parent | 9223794d49c8b8b34ae28876b298b17d4fad025b (diff) | |
download | nextcloud-server-fix/taskprocessing-cache.tar.gz nextcloud-server-fix/taskprocessing-cache.zip |
fix(TaskProcessing\Manager): Always use distributed cache and use PHP serializefix/taskprocessing-cache
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
-rw-r--r-- | lib/private/TaskProcessing/Manager.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/private/TaskProcessing/Manager.php b/lib/private/TaskProcessing/Manager.php index cb2434422aa..cdd9e909960 100644 --- a/lib/private/TaskProcessing/Manager.php +++ b/lib/private/TaskProcessing/Manager.php @@ -81,7 +81,6 @@ class Manager implements IManager { private IAppData $appData; private ?array $preferences = null; private ?array $providersById = null; - private ICache $cache; private ICache $distributedCache; public function __construct( @@ -101,7 +100,6 @@ class Manager implements IManager { ICacheFactory $cacheFactory, ) { $this->appData = $appDataFactory->get('core'); - $this->cache = $cacheFactory->createLocal('task_processing::'); $this->distributedCache = $cacheFactory->createDistributed('task_processing::'); } @@ -767,9 +765,8 @@ class Manager implements IManager { } 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'); + if ($this->availableTaskTypes === null && $this->distributedCache->get('available_task_types_v2') !== null) { + $this->availableTaskTypes = unserialize($this->distributedCache->get('available_task_types_v2')); } // Either we have no cache or showDisabled is turned on, which we don't want to cache, ever. if ($this->availableTaskTypes === null || $showDisabled) { @@ -812,7 +809,7 @@ class Manager implements IManager { } $this->availableTaskTypes = $availableTaskTypes; - $this->cache->set('available_task_types', $this->availableTaskTypes, 60); + $this->distributedCache->set('available_task_types_v2', serialize($this->availableTaskTypes), 60); } |