diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-04-27 17:39:55 +0300 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-04-28 12:55:39 +0300 |
commit | c103133272f1182eee2f4b00469e56687a86bedb (patch) | |
tree | b8a09dc95b492d950aa4d883e46559a2c41a1e88 /lib | |
parent | 92c0e60a430ac4c23054180f0e816c7a1c65aa11 (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.php | 6 |
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); } } |