summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-16 14:56:43 +0200
committerGitHub <noreply@github.com>2020-10-16 14:56:43 +0200
commit4bf891f60552a64984e6421ff74e02cdb39f9d51 (patch)
tree8ed51d0a60c938cdcdf9b19a7573c0d8addf4cc1 /lib
parent1c68a6d3f6fae83c76b1a602a48e593560a57cc5 (diff)
parentcce716f9f3ed53874d2f88f187ec77c442d0a609 (diff)
downloadnextcloud-server-4bf891f60552a64984e6421ff74e02cdb39f9d51.tar.gz
nextcloud-server-4bf891f60552a64984e6421ff74e02cdb39f9d51.zip
Merge pull request #23478 from nextcloud/fix/21059/fix-deadlock-in-scsscacher
Clear cached app config while waiting for the SCSSCache lock to return
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppConfig.php10
-rw-r--r--lib/private/Template/SCSSCacher.php8
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php
index b35bc4070dd..d3b64449879 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -344,4 +344,14 @@ class AppConfig implements IAppConfig {
$this->configLoaded = true;
}
+
+ /**
+ * Clear all the cached app config values
+ *
+ * WARNING: do not use this - this is only for usage with the SCSSCacher to
+ * clear the memory cache of the app config
+ */
+ public function clearCachedConfig() {
+ $this->configLoaded = false;
+ }
}
diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php
index d2c04a4a85a..225078ff6a4 100644
--- a/lib/private/Template/SCSSCacher.php
+++ b/lib/private/Template/SCSSCacher.php
@@ -30,6 +30,7 @@
namespace OC\Template;
+use OC\AppConfig;
use OC\Files\AppData\Factory;
use OC\Memcache\NullCache;
use OCP\AppFramework\Utility\ITimeFactory;
@@ -89,6 +90,8 @@ class SCSSCacher {
/** @var IMemcache */
private $lockingCache;
+ /** @var AppConfig */
+ private $appConfig;
/**
* @param ILogger $logger
@@ -109,7 +112,8 @@ class SCSSCacher {
$serverRoot,
ICacheFactory $cacheFactory,
IconsCacher $iconsCacher,
- ITimeFactory $timeFactory) {
+ ITimeFactory $timeFactory,
+ AppConfig $appConfig) {
$this->logger = $logger;
$this->appData = $appDataFactory->get('css');
$this->urlGenerator = $urlGenerator;
@@ -126,6 +130,7 @@ class SCSSCacher {
$this->lockingCache = $lockingCache;
$this->iconsCacher = $iconsCacher;
$this->timeFactory = $timeFactory;
+ $this->appConfig = $appConfig;
}
/**
@@ -166,6 +171,7 @@ class SCSSCacher {
$retry = 0;
sleep(1);
while ($retry < 10) {
+ $this->appConfig->clearCachedConfig();
$this->logger->debug('SCSSCacher::process check in while loop follows', ['app' => 'scss_cacher']);
if (!$this->variablesChanged() && $this->isCached($fileNameCSS, $app)) {
// Inject icons vars css if any