Skip to content

Commit ee74386

Browse files
committed
Make sure the cache is only reset once at a time
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent e51010b commit ee74386

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/private/Template/SCSSCacher.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)