Skip to content

Commit 6c0e6b5

Browse files
authored
Merge pull request #17579 from nextcloud/backport/17543/stable17
[stable17] Let SCSS cleanup only run once
2 parents 6b505fe + 53f8f21 commit 6c0e6b5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/private/Template/SCSSCacher.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function __construct(ILogger $logger,
117117
$this->serverRoot = $serverRoot;
118118
$this->cacheFactory = $cacheFactory;
119119
$this->depsCache = $cacheFactory->createDistributed('SCSS-deps-' . md5($this->urlGenerator->getBaseUrl()));
120-
$this->isCachedCache = $cacheFactory->createLocal('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl()));
120+
$this->isCachedCache = $cacheFactory->createDistributed('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl()));
121121
$lockingCache = $cacheFactory->createDistributed('SCSS-locks-' . md5($this->urlGenerator->getBaseUrl()));
122122
if (!($lockingCache instanceof IMemcache)) {
123123
$lockingCache = new NullCache();
@@ -269,8 +269,8 @@ private function isCached(string $fileNameCSS, string $app) {
269269
private function variablesChanged(): bool {
270270
$injectedVariables = $this->getInjectedVariables();
271271
if ($this->config->getAppValue('core', 'theming.variables') !== md5($injectedVariables)) {
272-
$this->resetCache();
273272
$this->config->setAppValue('core', 'theming.variables', md5($injectedVariables));
273+
$this->resetCache();
274274
return true;
275275
}
276276
return false;
@@ -364,6 +364,9 @@ private function cache(string $path, string $fileNameCSS, string $fileNameSCSS,
364364
* We need to regenerate all files when variables change
365365
*/
366366
public function resetCache() {
367+
if (!$this->lockingCache->add('resetCache', 'locked!', 120)) {
368+
return;
369+
}
367370
$this->injectedVariables = null;
368371

369372
// do not clear locks
@@ -381,6 +384,7 @@ public function resetCache() {
381384
}
382385
}
383386
$this->logger->debug('SCSSCacher: css cache cleared!');
387+
$this->lockingCache->remove('resetCache');
384388
}
385389

386390
/**

0 commit comments

Comments
 (0)