Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-04-27 17:39:55 +0300
committerSzymon Kłos <szymon.klos@collabora.com>2021-04-28 12:55:39 +0300
commitc103133272f1182eee2f4b00469e56687a86bedb (patch)
treeb8a09dc95b492d950aa4d883e46559a2c41a1e88 /lib
parent92c0e60a430ac4c23054180f0e816c7a1c65aa11 (diff)
Don't cache empty capabilities
When caching is configured and request to fetch the capabilities fails - don't cache the empty result for a long time. This way we will avoid persisting error: "Collabora Online is not setup yet". To test bug: 1. use Nextcloud with caching & richdocuments 2. restart apache and stop Collabora Online server 3. open Nextcloud and try to open any document you will get "Collabora Online is not setup yet" error 4. start Collabora Online server 5. refresh page and try to open file again before: error persisted until admin changed richdocuments configuration after: file is opened with Collabora Online in 60s from start Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Service/CapabilitiesService.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Service/CapabilitiesService.php b/lib/Service/CapabilitiesService.php
index 981b3640..58115795 100644
--- a/lib/Service/CapabilitiesService.php
+++ b/lib/Service/CapabilitiesService.php
@@ -113,6 +113,10 @@ class CapabilitiesService {
}
$this->capabilities = $capabilities;
- $this->cache->set('capabilities', $capabilities, 3600);
+ $ttl = 3600;
+ if (count($capabilities) === 0)
+ $ttl = 60;
+
+ $this->cache->set('capabilities', $capabilities, $ttl);
}
}